Commit f55e1d98 authored by Cedric Roux's avatar Cedric Roux

- Added support reliable link for ethernet transport

Note: this new feature is not compiled (and therefore not used) if libpgm-dev is not installed

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4011 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent f0cf6ab6
......@@ -5,4 +5,4 @@ ETHERNET_TRANSPORT_OBJS += $(TOP_DIR)/SIMULATION/ETH_TRANSPORT/multicast_link.o
ETHERNET_TRANSPORT_OBJS += $(TOP_DIR)/SIMULATION/ETH_TRANSPORT/socket.o
ETHERNET_TRANSPORT_OBJS += $(TOP_DIR)/SIMULATION/ETH_TRANSPORT/bypass_session_layer.o
ETHERNET_TRANSPORT_OBJS += $(TOP_DIR)/SIMULATION/ETH_TRANSPORT/emu_transport.o
ETHERNET_TRANSPORT_OBJS += $(TOP_DIR)/SIMULATION/ETH_TRANSPORT/pgm_link.o
......@@ -18,6 +18,8 @@
#include "UTIL/LOG/log.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
#include "pgm_link.h"
extern unsigned int Master_list_rx;
extern unsigned char NB_INST;
......@@ -29,6 +31,29 @@ void emu_transport_sync(void)
LOG_D(EMU, "Entering EMU transport SYNC is primary master %d\n",
oai_emulation.info.is_primary_master);
#if defined(ENABLE_PGM_TRANSPORT)
if (oai_emulation.info.is_primary_master == 0) {
bypass_tx_data(WAIT_SM_TRANSPORT,0,0);
// just wait to recieve the master 0 msg
Master_list_rx = oai_emulation.info.master_list - 1;
bypass_rx_data(0,0,0,1);
} else {
bypass_rx_data(0,0,0,0);
bypass_tx_data(WAIT_PM_TRANSPORT,0,0);
}
if (oai_emulation.info.master_list != 0) {
bypass_tx_data(SYNC_TRANSPORT,0,0);
bypass_rx_data(0,0,0,0);
// i received the sync from all secondary masters
if (emu_rx_status == SYNCED_TRANSPORT) {
emu_tx_status = SYNCED_TRANSPORT;
}
LOG_D(EMU,"TX secondary master SYNC_TRANSPORT state \n");
}
#else
if (oai_emulation.info.is_primary_master == 0) {
retry:
bypass_tx_data(WAIT_SM_TRANSPORT,0,0);
......@@ -58,6 +83,7 @@ retry2:
LOG_D(EMU,"TX secondary master SYNC_TRANSPORT state \n");
}
#endif
LOG_D(EMU, "Leaving EMU transport SYNC is primary master %d\n",
oai_emulation.info.is_primary_master);
}
......@@ -102,26 +128,15 @@ void emu_transport_DL(unsigned int frame, unsigned int last_slot,
{
LOG_D(EMU, "Entering EMU transport DL, is primary master %d\n",
oai_emulation.info.is_primary_master);
if (oai_emulation.info.is_primary_master==0) {
// bypass_rx_data(last_slot);
if (oai_emulation.info.nb_enb_local>0) { // send in DL if
bypass_tx_data(ENB_TRANSPORT,frame, next_slot);
bypass_rx_data(frame, last_slot, next_slot, 1);
} else {
bypass_tx_data(WAIT_SM_TRANSPORT,frame,next_slot);
bypass_rx_data(frame, last_slot, next_slot, 0);
}
} else { // I am the master
// bypass_tx_data(WAIT_TRANSPORT,last_slot);
if (oai_emulation.info.nb_enb_local>0) { // send in DL if
bypass_tx_data(ENB_TRANSPORT,frame, next_slot);
bypass_rx_data(frame,last_slot, next_slot, 1);
} else {
bypass_tx_data(WAIT_SM_TRANSPORT,frame, next_slot);
bypass_rx_data(frame,last_slot, next_slot, 0);
}
if (oai_emulation.info.nb_enb_local>0) { // send in DL if
bypass_tx_data(ENB_TRANSPORT, frame, next_slot);
bypass_rx_data(frame, last_slot, next_slot, 1);
} else {
bypass_tx_data(WAIT_SM_TRANSPORT,frame,next_slot);
bypass_rx_data(frame, last_slot, next_slot, 0);
}
LOG_D(EMU, "Leaving EMU transport DL, is primary master %d\n",
oai_emulation.info.is_primary_master);
}
......@@ -131,25 +146,15 @@ void emu_transport_UL(unsigned int frame, unsigned int last_slot,
{
LOG_D(EMU, "Entering EMU transport UL, is primary master %d\n",
oai_emulation.info.is_primary_master);
if (oai_emulation.info.is_primary_master==0) {
// bypass_rx_data(last_slot, next_slot);
if (oai_emulation.info.nb_ue_local>0) {
bypass_tx_data(UE_TRANSPORT, frame, next_slot);
bypass_rx_data(frame,last_slot, next_slot, 1);
} else {
bypass_tx_data(WAIT_SM_TRANSPORT, frame, next_slot);
bypass_rx_data(frame,last_slot, next_slot, 0);
}
if (oai_emulation.info.nb_ue_local>0) {
bypass_tx_data(UE_TRANSPORT, frame, next_slot);
bypass_rx_data(frame, last_slot, next_slot, 1);
} else {
// bypass_tx_data(WAIT_TRANSPORT,last_slot);
if (oai_emulation.info.nb_ue_local>0) {
bypass_tx_data(UE_TRANSPORT,frame, next_slot);
bypass_rx_data(frame,last_slot, next_slot, 1);
} else {
bypass_tx_data(WAIT_SM_TRANSPORT,frame, next_slot);
bypass_rx_data(frame,last_slot, next_slot, 0);
}
bypass_tx_data(WAIT_SM_TRANSPORT, frame, next_slot);
bypass_rx_data(frame,last_slot, next_slot, 0);
}
LOG_D(EMU, "Leaving EMU transport UL, is primary master %d\n",
oai_emulation.info.is_primary_master);
}
......
......@@ -39,9 +39,7 @@
extern unsigned short Master_id;
#define MULTICAST_LINK_NUM_GROUPS 4
char *multicast_group_list[MULTICAST_LINK_NUM_GROUPS] = {
const char *multicast_group_list[MULTICAST_LINK_NUM_GROUPS] = {
"239.0.0.161",
"239.0.0.162",
"239.0.0.163",
......@@ -63,7 +61,7 @@ static char *multicast_if;
//------------------------------------------------------------------------------
void
multicast_link_init ()
multicast_link_init(void)
{
//------------------------------------------------------------------------------
int group;
......@@ -103,7 +101,7 @@ multicast_link_init ()
}
}
#if !defined(ENABLE_TCP_MULTICAST)
#if !defined(ENABLE_NEW_MULTICAST)
/* Make the socket blocking */
socket_setnonblocking(group_list[group].socket);
#endif
......@@ -211,7 +209,7 @@ multicast_link_read ()
//------------------------------------------------------------------------------
int
multicast_link_write_sock (int groupP, char *dataP, uint32_t sizeP)
multicast_link_write_sock(int groupP, char *dataP, uint32_t sizeP)
{
//------------------------------------------------------------------------------
int num;
......@@ -231,7 +229,7 @@ int multicast_link_read_data_from_sock(uint8_t is_master)
int readsocks; /* Number of sockets ready for reading */
timeout.tv_sec = 0;
timeout.tv_usec = 3000;
timeout.tv_usec = 15000;
if (is_master == 0) {
/* UE will block indefinetely if no data is sent from eNB
......@@ -285,8 +283,9 @@ void multicast_link_start(void (*rx_handlerP) (unsigned int, char *),
LOG_I(EMU, "[MULTICAST] LINK START on interface=%s for group=%d: handler=%p\n",
(multicast_if == NULL) ? "not specified" : multicast_if, multicast_group,
rx_handler);
#if !defined(ENABLE_PGM_TRANSPORT)
multicast_link_init ();
#endif
#if ! defined(ENABLE_NEW_MULTICAST)
LOG_D(EMU, "[MULTICAST] multicast link start thread\n");
if (pthread_create (&main_loop_thread, NULL, multicast_link_main_loop,
......
......@@ -26,6 +26,10 @@ private_multicast_link (typedef struct multicast_group_t {
char rx_buffer[40000];
} multicast_group_t;)
#define MULTICAST_LINK_NUM_GROUPS 4
extern const char *multicast_group_list[MULTICAST_LINK_NUM_GROUPS];
private_multicast_link(void multicast_link_init ());
private_multicast_link(void multicast_link_read_data (int groupP));
private_multicast_link(void multicast_link_read ());
......
This diff is collapsed.
#ifndef PGM_LINK_H_
#define PGM_LINK_H_
/* Define prototypes only if enabled */
#if defined(ENABLE_PGM_TRANSPORT)
int pgm_oai_init(char *if_name);
int pgm_recv_msg(int group, uint8_t *buffer, uint32_t length);
int pgm_link_send_msg(int group, uint8_t *data, uint32_t len);
#endif
#endif /* PGM_LINK_H_ */
......@@ -14,7 +14,8 @@
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));
int bypass_rx_data (unsigned int frame, unsigned int last_slot, unsigned int next_slot, uint8_t is_master);
int bypass_rx_data(unsigned int frame, unsigned int last_slot,
unsigned int next_slot, uint8_t is_master);
void bypass_signal_mac_phy(unsigned int frame, unsigned int last_slot,
unsigned int next_slot, uint8_t is_master);
#ifndef USER_MODE
......
......@@ -46,7 +46,7 @@ do { \
#define DevCheck4(cOND, vALUE1, vALUE2, vALUE3, vALUE4) \
do { \
if (!(cOND)) { \
fprintf(stderr, "%s:%d:%s Assertion `"#cOND"` failed.\n", \
fprintf(stderr, "%s:%d:%s\nAssertion `"#cOND"` failed.\n", \
__FILE__, __LINE__, __FUNCTION__); \
fprintf(stderr, #vALUE1": %d\n"#vALUE2": %d\n"#vALUE3": %d\n" \
#vALUE4": %d\n", \
......
......@@ -3,14 +3,15 @@ all: oaisim naslite_netlink_ether
userclean: clean oaisim naslite_netlink_ether
oaisim:
(cd $(OPENAIR_TARGETS)/SIMU/USER && make NAS=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 Rel10=1 -j8)
(cd $(OPENAIR_TARGETS)/SIMU/USER && $(MAKE) NAS=1 OAI_NW_DRIVER_TYPE_ETHERNET=1)
naslite_netlink_ether:
(cd $(OPENAIR2_DIR) && make naslite_netlink_ether.ko)
(cd $(OPENAIR2_DIR)/NAS/DRIVER/LITE/RB_TOOL/ && make)
(cd $(OPENAIR2_DIR) && $(MAKE) naslite_netlink_ether.ko)
(cd $(OPENAIR2_DIR)/NAS/DRIVER/LITE/RB_TOOL/ && $(MAKE))
clean:
(cd $(OPENAIR2_DIR)/NAS/DRIVER/LITE && make clean)
(cd $(OPENAIR_TARGETS)/SIMU/USER && $(MAKE) clean)
(cd $(OPENAIR2_DIR)/NAS/DRIVER/LITE && $(MAKE) clean)
(cd $(OPENAIR_TARGETS)/SIMU/USER && make clean)
(cd $(OPENAIR_TARGETS)/SIMU/USER && make cleanasn1)
......@@ -221,6 +221,14 @@ CFLAGS += -DENABLE_VCD_FIFO
CFLAGS += -DENABLE_NEW_MULTICAST
# CFLAGS += -DENABLE_LOG_FIFO
# Check if libpgm is installed and use it if found instead of the unreliable
# multicast
ENABLE_PGM = $(shell if pkg-config --exists openpgm-5.1; then echo "1" ; else echo "0"; fi)
ifeq ($(ENABLE_PGM), 1)
CFLAGS += `pkg-config --cflags openpgm-5.1` -DENABLE_PGM_TRANSPORT
PGM_LDFLAGS = `pkg-config --libs openpgm-5.1`
endif
OBJ = $(PHY_OBJS) $(SIMULATION_OBJS) $(ETHERNET_TRANSPORT_OBJS) $(TOOLS_OBJS) $(SCHED_OBJS) $(STATS_OBJS) $(OAISIM_OBJS) $(NAS_OBJS) $(INT_OBJS) $(UTIL_OBJ)
ifeq ($(OPENAIR2),1)
OBJ += $(L2_OBJS)
......@@ -243,7 +251,9 @@ printvars:
@echo L2 objs are $(L2_OBJS)
@echo eNB_flag is $(eNB_flag)
@echo UE_flag is $(UE_flag)
@echo $(S1AP_BUILT_OBJS)
@echo S1AP objs: $(S1AP_BUILT_OBJS)
@echo CFLAGS: $(CFLAGS)
@echo Enable PGM: $(ENABLE_PGM)
ASN1RELDIR=R9.8
ifeq ($(USE_MME), R8)
......@@ -299,7 +309,7 @@ oaisim : $(ASN1_MSG_OBJS1) $(OBJ) oaisim.c $(LFDS_DIR)/bin/liblfds611.a
endif
@echo "Compiling oaisim.c ..."
@$(CC) -I$(TOP_DIR) $(L2_incl) $(UTIL_incl) -I$(ASN1_MSG_INC) $(S1AP_Incl) -o oaisim $(CFLAGS) $(EXTRA_CFLAGS) $^ \
-lm -lblas -lpthread -llapack_atlas -lforms -lxml2 -lX11 -lXpm -lrt $(LFDS_DIR)/bin/liblfds611.a
-lm -lblas -lpthread -llapack_atlas -lforms -lxml2 -lX11 -lXpm -lrt $(LFDS_DIR)/bin/liblfds611.a $(PGM_LDFLAGS)
ifeq ($(rrc_cellular_eNB),1)
mv oaisim oaisim_eNB
......
......@@ -411,13 +411,14 @@ int olg_config() {
set_glog(oai_emulation.info.g_log_level, oai_emulation.info.g_log_verbosity ); //g_glog
// component, log level, log interval
for (comp = PHY; comp < MAX_LOG_COMPONENTS ; comp++)
set_comp_log(comp,
oai_emulation.info.g_log_level,
oai_emulation.info.g_log_verbosity,
set_comp_log(comp,
oai_emulation.info.g_log_level,
oai_emulation.info.g_log_verbosity,
oai_emulation.emulation_config.log_emu.interval);
// if perf eval then reset the otg log level
set_comp_log(PHY, LOG_NONE, 0x15,1);
set_comp_log(EMU, LOG_NONE, 0x15,1);
set_comp_log(EMU, LOG_FULL, 0x15,1);
set_comp_log(OCG, LOG_NONE, 0x15,1);
set_comp_log(OCM, LOG_NONE, 0x15,1);
set_comp_log(OTG, LOG_NONE, 0x15,1);
......
......@@ -98,7 +98,7 @@ void get_simulation_options(int argc, char *argv[]) {
{NULL, 0, NULL, 0}
};
while ((c = getopt_long (argc, argv, "aA:b:B:c:C:d:eE:f:FGg:hi:IJ:k:l:m:M:n:N:O:p:P:rR:s:S:t:T:u:U:vVx:y:w:W:X:z:Z:", long_options, &option_index)) != -1) {
while ((c = getopt_long (argc, argv, "aA:b:B:c:C:D:d:eE:f:FGg:hi:IJ:k:l:m:M:n:N:O:p:P:rR:s:S:t:T:u:U:vVx:y:w:W:X:z:Z:", long_options, &option_index)) != -1) {
switch (c) {
case 0:
......@@ -248,8 +248,7 @@ void get_simulation_options(int argc, char *argv[]) {
oai_emulation.info.multicast_group = atoi (optarg);
break;
case 'D':
oai_emulation.info.multicast_ifname = malloc (strlen(optarg) + 1);
strcpy(oai_emulation.info.multicast_ifname, optarg);
oai_emulation.info.multicast_ifname = strdup(optarg);
break;
case 'B':
oai_emulation.topology_config.mobility.eNB_mobility.eNB_mobility_type.selected_option = optarg;
......
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