Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
oai
openairinterface5G
Commits
d62fe071
Commit
d62fe071
authored
Jan 16, 2018
by
Mongazon
Browse files
Fix
#582
, ENABLE_PGM_TRANSPORT removed, RRH related removed
parent
cf0e9175
Changes
21
Expand all
Hide whitespace changes
Inline
Side-by-side
cmake_targets/CMakeLists.txt
View file @
d62fe071
...
...
@@ -608,12 +608,6 @@ add_boolean_option(FLEXRAN_AGENT_SB_IF False "enable FlexRAN
##########################
add_boolean_option
(
ENB_MODE True
"Swap the include directories between openair2 and openair3"
)
##########################
# Emulation options
##########################
add_boolean_option
(
ENABLE_PGM_TRANSPORT False
"specific to oaisim, emulation through ethernet, reliable multicast"
)
add_boolean_option
(
ADDR_CONF False
"specific to oaisim, IP autoconf of user-plane IP interface"
)
##########################
# SCHEDULING/REAL-TIME/PERF options
##########################
...
...
@@ -1595,7 +1589,6 @@ ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c
${
OPENAIR1_DIR
}
/SIMULATION/ETH_TRANSPORT/socket.c
${
OPENAIR1_DIR
}
/SIMULATION/ETH_TRANSPORT/bypass_session_layer.c
#${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/emu_transport.c
${
OPENAIR1_DIR
}
/SIMULATION/ETH_TRANSPORT/pgm_link.c
)
add_library
(
OPENAIR0_LIB
...
...
@@ -1812,27 +1805,6 @@ target_link_libraries (lte-softmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt
target_link_libraries
(
lte-softmodem-nos1
${
LIB_LMS_LIBRARIES
}
)
target_link_libraries
(
lte-softmodem-nos1
${
T_LIB
}
)
# rrh
################################
#Note: only one RF type (USRP) is currently supported for RRH
add_executable
(
rrh_gw
${
OPENAIR_TARGETS
}
/RT/USER/rrh_gw.c
${
OPENAIR_TARGETS
}
/RT/USER/eNB_transport_IQ.c
${
OPENAIR_TARGETS
}
/RT/USER/UE_transport_IQ.c
${
OPENAIR_TARGETS
}
/RT/USER/rt_wrapper.c
${
OPENAIR_TARGETS
}
/ARCH/COMMON/common_lib.c
${
T_SOURCE
}
)
target_include_directories
(
rrh_gw PRIVATE
${
OPENAIR_DIR
}
/common/utils/itti
)
target_link_libraries
(
rrh_gw
-Wl,--start-group
UTIL LFDS -ldl
-Wl,--end-group
)
target_link_libraries
(
rrh_gw rt pthread m
)
target_link_libraries
(
rrh_gw
${
LIB_LMS_LIBRARIES
}
)
target_link_libraries
(
rrh_gw
${
T_LIB
}
)
# USIM process
#################
#add_executable(usim
...
...
@@ -2047,7 +2019,7 @@ endforeach(myExe)
if
(
${
T_TRACER
}
)
foreach
(
i
#all "add_executable" definitions (except tests, rb_tool, updatefw)
lte-softmodem lte-softmodem-nos1
rrh_gw
oaisim oaisim_nos1
lte-softmodem lte-softmodem-nos1 oaisim oaisim_nos1
dlsim_tm4 dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim
pdcchsim pucchsim prachsim syncsim
#all "add_library" definitions
...
...
cmake_targets/build_oai
View file @
d62fe071
...
...
@@ -100,8 +100,6 @@ Options
Specify conf_nvram_path (default
\"
$conf_nvram_path
\"
)
--UE-gen-nvram [output path]
Specify gen_nvram_path (default
\"
$gen_nvram_path
\"
)
--RRH
Makes the RRH
-a | --agent
Enables agent for software-defined control of the eNB
-r | --3gpp-release
...
...
@@ -219,10 +217,6 @@ function main() {
--UE-gen-nvram
)
gen_nvram_path
=
$(
readlink
-f
$2
)
shift
2
;;
--RRH
)
RRH
=
1
echo_info
"Will compile RRH"
shift
;;
-r
|
--3gpp-release
)
REL
=
$2
echo_info
"Setting release to:
$REL
"
...
...
@@ -371,7 +365,7 @@ function main() {
echo_info
"CMAKE_CMD=
$CMAKE_CMD
"
#########################################################
# check validity of HW and TP parameters for
RRH and
eNB
# check validity of HW and TP parameters for eNB
#########################################################
# to be discussed
...
...
@@ -387,15 +381,6 @@ function main() {
fi
fi
if
[
"
$RRH
"
=
"1"
]
;
then
if
[
"
$TP
"
=
"None"
]
;
then
echo_fatal
"A transport protocol (e.g. -t ETHERNET) must be defined!"
fi
if
[
"
$HW
"
=
"None"
]
;
then
echo_info
"No radio head has been selected (HW set to
$HW
)"
fi
fi
echo_info
"RF HW set to
$HW
"
#Now we set flags to enable deadline scheduler settings
#By default: USRP: disable,
...
...
@@ -793,36 +778,6 @@ function main() {
# oaisim_mme $dbin/oaisim_mme.$REL
fi
# RRH compilation
#####################
if
[
"
$RRH
"
=
"1"
]
;
then
rrh_exec
=
rrh_gw
rrh_build_dir
=
rrh_gw
echo_info
"Compiling
$rrh_exec
..."
[
"
$CLEAN
"
=
"1"
]
&&
rm
-rf
$DIR
/rrh_gw/build
mkdir
-p
$DIR
/
$rrh_build_dir
/build
cmake_file
=
$DIR
/
$rrh_build_dir
/CMakeLists.txt
echo
"cmake_minimum_required(VERSION 2.8)"
>
$cmake_file
echo
"set ( CMAKE_BUILD_TYPE
$CMAKE_BUILD_TYPE
)"
>>
$cmake_file
echo
"set ( ENABLE_VCD_FIFO
$VCD_TIMING
)"
>>
$cmake_file
echo
"set ( ENABLE_ITTI False )"
>>
$cmake_file
echo
"set ( RF_BOARD
\"
${
HW
}
\"
)"
>>
$cmake_file
echo
"set ( TRANSP_PRO
\"
${
TP
}
\"
)"
>>
$cmake_file
echo
'set ( PACKAGE_NAME "\"rrh_gw\"")'
>>
$cmake_file
echo
"set ( DEADLINE_SCHEDULER
\"
${
DEADLINE_SCHEDULER_FLAG_USER
}
\"
)"
>>
$cmake_file
echo
"set ( CPU_AFFINITY
\"
${
CPU_AFFINITY_FLAG_USER
}
\"
)"
>>
$cmake_file
echo
"set ( T_TRACER
$T_TRACER
)"
>>
$cmake_file
echo
'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)'
>>
$cmake_file
cd
$DIR
/
$rrh_build_dir
/build
eval
$CMAKE_CMD
compilations
\
rrh_gw rrh_gw
\
rrh_gw
$dbin
/rrh_gw
fi
# Telnet server compilation
#####################
if
[
"
$BUILD_TELNETSRV
"
=
"1"
]
;
then
...
...
@@ -841,13 +796,9 @@ function main() {
fi
# build RF device and transport protocol libraries
#####################################
if
[
"
$eNB
"
=
"1"
-o
"
$UE
"
=
"1"
-o
"
$RRH
"
=
"1"
]
;
then
if
[
"
$eNB
"
=
"1"
-o
"
$UE
"
=
"1"
]
;
then
if
[
"
$eNB
"
=
"1"
-o
"
$UE
"
=
"1"
]
;
then
build_dir
=
$lte_build_dir
else
build_dir
=
$rrh_build_dir
fi
build_dir
=
$lte_build_dir
# build RF device libraries
if
[
"
$HW
"
!=
"None"
]
;
then
...
...
cmake_targets/epc_test/CMakeLists.template
View file @
d62fe071
...
...
@@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 2.8)
set ( CMAKE_BUILD_TYPE "RelWithDebInfo" )
set ( ASN_DEBUG False)
set ( ADDR_CONF False )
set ( DEBUG_OMG False )
set ( DISABLE_XER_PRINT False )
set ( DRIVER2013 True )
...
...
@@ -11,7 +10,6 @@ set ( ENABLE_FXP True )
set ( ENABLE_ITTI True )
set ( ENABLE_NAS_UE_LOGGING True )
set ( ENABLE_NEW_MULTICAST True )
set ( ENABLE_PGM_TRANSPORT True )
set ( ENABLE_SECURITY True )
set ( ENABLE_STANDALONE_EPC False)
set ( ENABLE_USE_CPU_EXECUTION_TIME True )
...
...
cmake_targets/oaisim_build_oai/CMakeLists.template
View file @
d62fe071
cmake_minimum_required(VERSION 2.8)
set ( CMAKE_BUILD_TYPE "RelWithDebInfo" )
set ( ADDR_CONF False )
set ( DEBUG_OMG False )
set ( DISABLE_XER_PRINT False )
set ( DRIVER2013 True )
...
...
@@ -9,7 +8,6 @@ set ( ENABLE_FXP True )
set ( ENABLE_ITTI True )
set ( ENABLE_NAS_UE_LOGGING True )
set ( ENABLE_NEW_MULTICAST True )
set ( ENABLE_PGM_TRANSPORT True )
set ( ENABLE_RAL False )
set ( ENABLE_SECURITY True )
set ( ENABLE_STANDALONE_EPC False)
...
...
cmake_targets/oaisim_mme_build_oai/CMakeLists.template
View file @
d62fe071
cmake_minimum_required(VERSION 2.8)
set ( CMAKE_BUILD_TYPE "RelWithDebInfo" )
set ( ADDR_CONF False )
set ( DEBUG_OMG False )
set ( DISABLE_XER_PRINT False )
set ( DRIVER2013 False )
...
...
@@ -9,7 +8,6 @@ set ( ENABLE_FXP False )
set ( ENABLE_ITTI True )
set ( ENABLE_NAS_UE_LOGGING False )
set ( ENABLE_NEW_MULTICAST False )
set ( ENABLE_PGM_TRANSPORT False )
set ( ENABLE_RAL False )
set ( ENABLE_SECURITY False )
set ( ENABLE_STANDALONE_EPC False )
...
...
cmake_targets/oaisim_noS1_build_oai/CMakeLists.template
View file @
d62fe071
cmake_minimum_required(VERSION 2.8)
set ( ADDR_CONF False )
set ( DEBUG_OMG False )
set ( DISABLE_XER_PRINT False )
set ( DRIVER2013 True )
...
...
@@ -8,7 +7,6 @@ set ( ENABLE_FXP True )
set ( ENABLE_ITTI True )
set ( ENABLE_NAS_UE_LOGGING False )
set ( ENABLE_NEW_MULTICAST True )
set ( ENABLE_PGM_TRANSPORT True )
set ( ENABLE_RAL False )
set ( ENABLE_SECURITY False )
set ( ENABLE_STANDALONE_EPC False)
...
...
cmake_targets/s1c_mme_test/CMakeLists.template
View file @
d62fe071
cmake_minimum_required(VERSION 2.8)
set ( CMAKE_BUILD_TYPE "RelWithDebInfo" )
set ( ADDR_CONF False )
set ( DEBUG_OMG False )
set ( DISABLE_XER_PRINT False )
set ( DRIVER2013 True )
...
...
@@ -10,7 +9,6 @@ set ( ENABLE_ITTI True )
set ( ENABLE_NAS_UE_LOGGING True )
set ( ENABLE_NEW_MULTICAST True )
set ( ENABLE_PDCP_NETLINK_FIFO False )
set ( ENABLE_PGM_TRANSPORT True )
set ( ENABLE_RAL False )
set ( ENABLE_SECURITY True )
set ( ENABLE_STANDALONE_EPC False)
...
...
openair1/SIMULATION/ETH_TRANSPORT/bypass_session_layer.c
View file @
d62fe071
...
...
@@ -39,7 +39,6 @@
#include
"UTIL/LOG/log.h"
#include
"multicast_link.h"
#include
"pgm_link.h"
char
rx_bufferP
[
BYPASS_RX_BUFFER_SIZE
];
unsigned
int
num_bytesP
=
0
;
...
...
@@ -49,10 +48,6 @@ static unsigned int byte_tx_count;
unsigned
int
Master_list_rx
;
static
uint64_t
seq_num_tx
=
0
;
#if defined(ENABLE_PGM_TRANSPORT)
extern
unsigned
int
pgm_would_block
;
#endif
mapping
transport_names
[]
=
{
{
"WAIT PM TRANSPORT INFO"
,
EMU_TRANSPORT_INFO_WAIT_PM
},
{
"WAIT SM TRANSPORT INFO"
,
EMU_TRANSPORT_INFO_WAIT_SM
},
...
...
@@ -60,9 +55,6 @@ mapping transport_names[] = {
{
"ENB_TRANSPORT INFO"
,
EMU_TRANSPORT_INFO_ENB
},
{
"UE TRANSPORT INFO"
,
EMU_TRANSPORT_INFO_UE
},
{
"RELEASE TRANSPORT INFO"
,
EMU_TRANSPORT_INFO_RELEASE
},
#if defined(ENABLE_PGM_TRANSPORT)
{
"NACK TRANSPORT INFO"
,
EMU_TRANSPORT_NACK
},
#endif
{
NULL
,
-
1
}
};
...
...
@@ -77,9 +69,6 @@ void init_bypass (void)
pthread_mutex_init
(
&
emul_low_mutex
,
NULL
);
pthread_cond_init
(
&
emul_low_cond
,
NULL
);
emul_low_mutex_var
=
1
;
#endif
#if defined(ENABLE_PGM_TRANSPORT)
pgm_oai_init
(
oai_emulation
.
info
.
multicast_ifname
);
#endif
bypass_init
(
emul_tx_handler
,
emul_rx_handler
);
}
...
...
@@ -318,20 +307,12 @@ int bypass_rx_data(unsigned int frame, unsigned int last_slot,
frame
,
next_slot
,
is_master
);
#if defined(ENABLE_NEW_MULTICAST)
# if defined(ENABLE_PGM_TRANSPORT)
num_bytesP
=
pgm_recv_msg
(
oai_emulation
.
info
.
multicast_group
,
(
uint8_t
*
)
&
rx_bufferP
[
0
],
sizeof
(
rx_bufferP
),
frame
,
next_slot
);
DevCheck
(
num_bytesP
>
0
,
num_bytesP
,
0
,
0
);
# else
if
(
multicast_link_read_data_from_sock
(
is_master
)
==
1
)
{
/* We got a timeout */
return
-
1
;
}
# endif
#else
pthread_mutex_lock
(
&
emul_low_mutex
);
...
...
@@ -359,10 +340,6 @@ int bypass_rx_data(unsigned int frame, unsigned int last_slot,
num_bytesP
,
map_int_to_str
(
transport_names
,
messg
->
Message_type
),
messg
->
master_id
,
messg
->
seq_num
);
#if defined(ENABLE_PGM_TRANSPORT)
if
(
messg
->
Message_type
!=
EMU_TRANSPORT_NACK
)
#endif
DevCheck4
((
messg
->
frame
==
frame
)
&&
(
messg
->
subframe
==
(
next_slot
>>
1
)),
messg
->
frame
,
frame
,
messg
->
subframe
,
next_slot
>>
1
);
...
...
@@ -405,20 +382,6 @@ int bypass_rx_data(unsigned int frame, unsigned int last_slot,
Master_list_rx
=
oai_emulation
.
info
.
master_list
;
LOG_E
(
EMU
,
"RX EMU_TRANSPORT_INFO_RELEASE
\n
"
);
break
;
#if defined(ENABLE_PGM_TRANSPORT)
case
EMU_TRANSPORT_NACK
:
if
(
messg
->
failing_master_id
==
oai_emulation
.
info
.
master_id
)
{
/* We simply re-send the last message */
pgm_link_send_msg
(
oai_emulation
.
info
.
multicast_group
,
(
uint8_t
*
)
bypass_tx_buffer
,
byte_tx_count
);
}
else
{
/* Sleep awhile till other peers have recovered data */
usleep
(
500
);
}
break
;
#endif
default:
LOG_E
(
EMU
,
"[MAC][BYPASS] ERROR RX UNKNOWN MESSAGE
\n
"
);
...
...
@@ -483,13 +446,6 @@ void bypass_signal_mac_phy(unsigned int frame, unsigned int last_slot,
}
}
#if defined(ENABLE_PGM_TRANSPORT)
void
bypass_tx_nack
(
unsigned
int
frame
,
unsigned
int
next_slot
)
{
bypass_tx_data
(
NACK_TRANSPORT
,
frame
,
next_slot
);
}
#endif
/***************************************************************************/
void
bypass_tx_data
(
emu_transport_info_t
Type
,
unsigned
int
frame
,
unsigned
int
next_slot
)
{
...
...
@@ -519,26 +475,6 @@ void bypass_tx_data(emu_transport_info_t Type, unsigned int frame, unsigned int
byte_tx_count
=
sizeof
(
bypass_msg_header_t
)
+
sizeof
(
bypass_proto2multicast_header_t
);
#if defined(ENABLE_PGM_TRANSPORT)
if
(
Type
==
NACK_TRANSPORT
)
{
int
i
;
messg
->
Message_type
=
EMU_TRANSPORT_NACK
;
for
(
i
=
0
;
i
<
oai_emulation
.
info
.
nb_master
;
i
++
)
{
/* Skip our id */
if
(
i
==
oai_emulation
.
info
.
master_id
)
continue
;
if
((
Master_list_rx
&
(
1
<<
i
))
==
0
)
{
messg
->
failing_master_id
=
i
;
break
;
}
}
LOG_T
(
EMU
,
"[TX_DATA] NACK TRANSPORT
\n
"
);
}
else
#endif
if
(
Type
==
WAIT_PM_TRANSPORT
)
{
messg
->
Message_type
=
EMU_TRANSPORT_INFO_WAIT_PM
;
LOG_T
(
EMU
,
"[TX_DATA] WAIT SYNC PM TRANSPORT
\n
"
);
...
...
@@ -630,13 +566,8 @@ void bypass_tx_data(emu_transport_info_t Type, unsigned int frame, unsigned int
((
bypass_proto2multicast_header_t
*
)
bypass_tx_buffer
)
->
size
=
byte_tx_count
-
sizeof
(
bypass_proto2multicast_header_t
);
#if defined(ENABLE_PGM_TRANSPORT)
pgm_link_send_msg
(
oai_emulation
.
info
.
multicast_group
,
(
uint8_t
*
)
bypass_tx_buffer
,
byte_tx_count
);
#else
multicast_link_write_sock
(
oai_emulation
.
info
.
multicast_group
,
bypass_tx_buffer
,
byte_tx_count
);
#endif
LOG_D
(
EMU
,
"Frame %d, subframe %d (%d): Sent %d bytes [%s] with master_id %d and seq %"
PRIuMAX
"
\n
"
,
frame
,
next_slot
>>
1
,
next_slot
,
byte_tx_count
,
map_int_to_str
(
transport_names
,
Type
),
...
...
openair1/SIMULATION/ETH_TRANSPORT/defs.h
View file @
d62fe071
...
...
@@ -41,9 +41,6 @@ typedef enum emu_transport_info_e {
EMU_TRANSPORT_INFO_ENB
,
EMU_TRANSPORT_INFO_UE
,
EMU_TRANSPORT_INFO_RELEASE
#if defined(ENABLE_PGM_TRANSPORT)
,
EMU_TRANSPORT_NACK
#endif
}
emu_transport_info_t
;
#define WAIT_PM_TRANSPORT 1
...
...
@@ -52,9 +49,6 @@ typedef enum emu_transport_info_e {
#define ENB_TRANSPORT 4
#define UE_TRANSPORT 5
#define RELEASE_TRANSPORT 6
#if defined(ENABLE_PGM_TRANSPORT)
# define NACK_TRANSPORT 7
#endif
#define WAIT_SYNC_TRANSPORT 1
#define SYNCED_TRANSPORT 2
...
...
openair1/SIMULATION/ETH_TRANSPORT/emu_transport.c
View file @
d62fe071
...
...
@@ -40,49 +40,17 @@
#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
;
//#define DEBUG_CONTROL 1
//#define DEBUG_EMU 1
#if defined(ENABLE_PGM_TRANSPORT)
extern
unsigned
int
pgm_would_block
;
#endif
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
);
...
...
@@ -115,8 +83,6 @@ 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
);
}
...
...
@@ -154,9 +120,6 @@ void emu_transport(unsigned int frame, unsigned int last_slot,
}
}
#if defined(ENABLE_PGM_TRANSPORT)
pgm_would_block
=
0
;
#endif
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_EMU_TRANSPORT
,
VCD_FUNCTION_OUT
);
}
...
...
openair1/SIMULATION/ETH_TRANSPORT/multicast_link.c
View file @
d62fe071
...
...
@@ -314,9 +314,7 @@ 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
"
);
...
...
openair1/SIMULATION/ETH_TRANSPORT/pgm_link.c
deleted
100644 → 0
View file @
cf0e9175
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file pgm_link.c
* \brief implementation a warpper for openpgm for reliable multicast transmission
* \author Navid Nikaein and S. Roux
* \date 2013 - 2014
* \version 1.0
* \company Eurecom
* \email: navid.nikaein@eurecom.fr
*/
#include
<pthread.h>
#include
<stdint.h>
#include
<string.h>
#include
<errno.h>
#include
<unistd.h>
#include
<arpa/inet.h>
#if defined(ENABLE_PGM_TRANSPORT)
#include
<pgm/pgm.h>
#include
"assertions.h"
#include
"pgm_link.h"
#include
"multicast_link.h"
#include
"UTIL/OCG/OCG.h"
#include
"UTIL/OCG/OCG_extern.h"
#include
"UTIL/LOG/log.h"
// #define ENABLE_PGM_DEBUG
typedef
struct
{
pgm_sock_t
*
sock
;
uint16_t
port
;
uint8_t
rx_buffer
[
40000
];
}
pgm_multicast_group_t
;
pgm_multicast_group_t
pgm_multicast_group
[
MULTICAST_LINK_NUM_GROUPS
];
static
int
pgm_create_socket
(
int
index
,
const
char
*
if_addr
);
unsigned
int
pgm_would_block
=
1
;
#if defined(ENABLE_PGM_DEBUG)
static
void
log_handler
(
const
int
log_level
,
const
char
*
message
,
void
*
closure
)
{
printf
(
"%s
\n
"
,
message
);
}
#endif
int
pgm_oai_init
(
char
*
if_addr
)
{
pgm_error_t
*
pgm_err
=
NULL
;
memset
(
pgm_multicast_group
,
0
,
MULTICAST_LINK_NUM_GROUPS
*
sizeof
(
pgm_multicast_group_t
));
#if defined(ENABLE_PGM_DEBUG)
pgm_messages_init
();
pgm_min_log_level
=
PGM_LOG_LEVEL_DEBUG
;
pgm_log_mask
=
0xFFF
;
pgm_log_set_handler
(
log_handler
,
NULL
);
#endif
if
(
!
pgm_init
(
&
pgm_err
))
{
LOG_E
(
EMU
,
"Unable to start PGM engine: %s
\n
"
,
pgm_err
->
message
);
pgm_error_free
(
pgm_err
);
exit
(
EXIT_FAILURE
);
}
return
pgm_create_socket
(
oai_emulation
.
info
.
multicast_group
,
if_addr
);
}
int
pgm_recv_msg
(
int
group
,
uint8_t
*
buffer
,
uint32_t
length
,
unsigned
int
frame
,
unsigned
int
next_slot
)
{
size_t
num_bytes
=
0
;
int
status
=
0
;
pgm_error_t
*
pgm_err
=
NULL
;
struct
pgm_sockaddr_t
from
;
socklen_t
fromlen
=
sizeof
(
from
);
uint32_t
timeout
=
0
;
int
flags
=
0
;
if
(
pgm_would_block
==
0
)
{
flags
=
MSG_DONTWAIT
;
}
DevCheck
((
group
<=
MULTICAST_LINK_NUM_GROUPS
)
&&
(
group
>=
0
),
group
,
MULTICAST_LINK_NUM_GROUPS
,
0
);
#ifdef DEBUG_EMU
LOG_I
(
EMU
,
"[PGM] Entering recv function for group %d
\n
"
,
group
);
#endif
do
{
status
=
pgm_recvfrom
(
pgm_multicast_group
[
group
].
sock
,
buffer
,
length
,
flags
,
&
num_bytes
,
&
from
,
&
fromlen
,
&
pgm_err
);
if
(
PGM_IO_STATUS_NORMAL
==
status
)
{
#ifdef DEBUG_EMU
LOG_D
(
EMU
,
"[PGM] Received %d bytes for group %d
\n
"
,
num_bytes
,
group
);
#endif
return
num_bytes
;
}
else
if
(
PGM_IO_STATUS_TIMER_PENDING
==
status
)
{
if
(
pgm_would_block
==
0
)
{
/* We sleep for 50 usec */
usleep
(
50
);