Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
常顺宇
OpenXG-RAN
Commits
a1347e1a
Commit
a1347e1a
authored
6 years ago
by
laurent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compilation cleanup
parent
11fd202d
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
304 additions
and
967 deletions
+304
-967
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+9
-4
cmake_targets/build_oai
cmake_targets/build_oai
+6
-6
openair1/PHY/LTE_ESTIMATION/adjust_gain.c
openair1/PHY/LTE_ESTIMATION/adjust_gain.c
+2
-22
openair1/PHY/LTE_TRANSPORT/dci.c
openair1/PHY/LTE_TRANSPORT/dci.c
+1
-1
openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c
openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c
+4
-13
openair1/SCHED_UE/phy_procedures_lte_ue.c
openair1/SCHED_UE/phy_procedures_lte_ue.c
+15
-19
openair2/COMMON/mac_rrc_primitives.h
openair2/COMMON/mac_rrc_primitives.h
+0
-82
openair2/COMMON/platform_constants.h
openair2/COMMON/platform_constants.h
+0
-13
openair2/LAYER2/MAC/mac_vars.h
openair2/LAYER2/MAC/mac_vars.h
+0
-1
openair2/LAYER2/MAC/main_ue.c
openair2/LAYER2/MAC/main_ue.c
+0
-1
openair2/LAYER2/MAC/ue_procedures.c
openair2/LAYER2/MAC/ue_procedures.c
+0
-2
openair2/LAYER2/PDCP_v10.1.0/pdcp.h
openair2/LAYER2/PDCP_v10.1.0/pdcp.h
+2
-0
openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c
openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c
+2
-0
openair2/LAYER2/openair2_proc.c
openair2/LAYER2/openair2_proc.c
+0
-126
openair2/LAYER2/register.h
openair2/LAYER2/register.h
+0
-38
openair2/NETWORK_DRIVER/UE_IP/device.c
openair2/NETWORK_DRIVER/UE_IP/device.c
+1
-1
openair2/NETWORK_DRIVER/UE_IP/local.h
openair2/NETWORK_DRIVER/UE_IP/local.h
+0
-1
openair2/PHY_INTERFACE/IF_Module.c
openair2/PHY_INTERFACE/IF_Module.c
+2
-2
openair2/RRC/LTE/rrc_UE.c
openair2/RRC/LTE/rrc_UE.c
+4
-9
openair2/RRC/LTE/rrc_eNB.c
openair2/RRC/LTE/rrc_eNB.c
+5
-9
openair2/RRC/LTE/rrm_2_rrc_msg.c
openair2/RRC/LTE/rrm_2_rrc_msg.c
+0
-205
openair2/RRC/LTE/utils.c
openair2/RRC/LTE/utils.c
+1
-2
targets/ARCH/tcp_bridge/tcp_bridge_oai.c
targets/ARCH/tcp_bridge/tcp_bridge_oai.c
+244
-382
targets/COMMON/openairinterface5g_limits.h
targets/COMMON/openairinterface5g_limits.h
+6
-27
targets/TEST/PDCP/with_rlc/test_pdcp_rlc.c
targets/TEST/PDCP/with_rlc/test_pdcp_rlc.c
+0
-1
No files found.
cmake_targets/CMakeLists.txt
View file @
a1347e1a
...
...
@@ -21,7 +21,7 @@
# Author: laurent THOMAS, Lionel GAUTHIER
cmake_minimum_required
(
VERSION
2.8
)
cmake_minimum_required
(
VERSION
3.0
)
#############################################
# Base directories, compatible with legacy OAI building
...
...
@@ -169,11 +169,12 @@ endif()
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
${
C_FLAGS_PROCESSOR
}
-std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing -rdynamic -funroll-loops -Wno-packed-bitfield-compat -fPIC "
)
# add autotools definitions that were maybe used!
set
(
MKVER
"'MAKE_VERSION(a,b,c)=((a)*256+(b)*16+c)'"
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP -D'MAKE_VERSION(a,b,c)=((a)*256+(b)*16+c)'
"
"
${
CMAKE_C_FLAGS
}
-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP -D
${
MKVER
}
"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
${
C_FLAGS_PROCESSOR
}
-std=c++11 -D'MAKE_VERSION(a,b,c)=((a)*256+(b)*16+c)'
"
"
${
CMAKE_CXX_FLAGS
}
${
C_FLAGS_PROCESSOR
}
-std=c++11 -D
${
MKVER
}
"
)
add_definitions
(
"-DASN_DISABLE_OER_SUPPORT"
)
...
...
@@ -480,6 +481,10 @@ add_list1_option(NB_ANTENNAS_RX "2" "Number of antennas in reception" "1" "2" "4
add_list1_option
(
NB_ANTENNAS_TX
"4"
"Number of antennas in transmission"
"1"
"2"
"4"
)
add_list2_option
(
RF_BOARD
"EXMIMO"
"RF head type"
"None"
"EXMIMO"
"OAI_USRP"
"OAI_BLADERF"
"CPRIGW"
"OAI_LMSSDR"
)
if
(
NOT
${
RF_BOARD
}
STREQUAL
"None"
)
add_definitions
(
-DMANAGED_RF=1
)
endif
()
add_list2_option
(
TRANSP_PRO
"None"
"Transport protocol type"
"None"
"ETHERNET"
)
#NOKIA config enhancement
...
...
@@ -2272,7 +2277,7 @@ endfunction(make_driver name dir src)
# nashmesh module
################
list
(
APPEND nasmesh_src device.c common.c ioctl.c classifier.c tool.c mesh.c
)
set
(
module_cc_opt
"
${
module_cc_opt
}
-DNAS_NETLINK -DPDCP_USE_NETLINK"
)
set
(
module_cc_opt
"
${
module_cc_opt
}
-DNAS_NETLINK -DPDCP_USE_NETLINK
-D
${
MKVER
}
"
)
# legacy Makefile was using NAS_NETLINK flag, but other drivers the hereafter flag
# so, this cmake use OAI_NW_DRIVER_USE_NETLINK everywhere
if
(
OAI_NW_DRIVER_USE_NETLINK
)
...
...
This diff is collapsed.
Click to expand it.
cmake_targets/build_oai
View file @
a1347e1a
...
...
@@ -107,7 +107,7 @@ Options
Rel8 limits the implementation to 3GPP Release 8 version
Rel10 limits the implementation to 3GPP Release 10 version
-w | --hardware
EXMIMO, USRP, BLADERF, ETHERNET, LMSSDR, IRIS, None (Default)
EXMIMO, USRP, BLADERF, ETHERNET, LMSSDR, IRIS,
SIMU,
None (Default)
Adds this RF board support (in external packages installation and in compilation)
-t | --transport protocol
ETHERNET , None
...
...
@@ -236,7 +236,7 @@ function main() {
"EXMIMO"
)
HW
=
"EXMIMO"
;;
"USRP"
|
"BLADERF"
|
"LMSSDR"
|
"IRIS"
)
"USRP"
|
"BLADERF"
|
"LMSSDR"
|
"IRIS"
|
"SIMU"
)
HW
=
"OAI_"
$2
;;
"None"
)
...
...
@@ -512,7 +512,7 @@ function main() {
[
"
$CLEAN
"
=
"1"
]
&&
rm
-rf
$DIR
/
$lte_build_dir
/build
mkdir
-p
$DIR
/
$lte_build_dir
/build
cmake_file
=
$DIR
/
$lte_build_dir
/CMakeLists.txt
echo
"cmake_minimum_required(VERSION
2.8
)"
>
$cmake_file
echo
"cmake_minimum_required(VERSION
3.0
)"
>
$cmake_file
if
[
"
$NOS1
"
=
"True"
]
;
then
cat
$DIR
/
$lte_build_dir
/CMakeLists.template
>>
$cmake_file
fi
...
...
@@ -787,7 +787,7 @@ function main() {
fi
fi
if
[
"
$RFSIMULATOR
"
==
"true"
]
;
then
if
[
"
$RFSIMULATOR
"
==
"true"
-o
"
$HW
"
==
"OAI_SIMU"
]
;
then
echo_info
"Compiling rfsimulator"
compilations
\
$lte_build_dir
rfsimulator
\
...
...
@@ -852,7 +852,7 @@ function main() {
# enb
cmake_file
=
$OPENAIR_DIR
/cmake_targets/basic_simulator/enb/CMakeLists.txt
echo
"cmake_minimum_required(VERSION
2.8
)"
>
$cmake_file
echo
"cmake_minimum_required(VERSION
3.0
)"
>
$cmake_file
echo
"set ( CMAKE_BUILD_TYPE
$CMAKE_BUILD_TYPE
)"
>>
$cmake_file
echo
"set ( CFLAGS_PROCESSOR_USER
\"
$CFLAGS_PROCESSOR_USER
\"
)"
>>
$cmake_file
echo
"set ( RRC_ASN1_VERSION
\"
${
REL
}
\"
)"
>>
$cmake_file
...
...
@@ -905,7 +905,7 @@ function main() {
conf2uedata
$dbin
/conf2uedata
cmake_file
=
$OPENAIR_DIR
/cmake_targets/basic_simulator/ue/CMakeLists.txt
echo
"cmake_minimum_required(VERSION
2.8
)"
>
$cmake_file
echo
"cmake_minimum_required(VERSION
3.0
)"
>
$cmake_file
echo
"set ( CMAKE_BUILD_TYPE
$CMAKE_BUILD_TYPE
)"
>>
$cmake_file
echo
"set ( CFLAGS_PROCESSOR_USER
\"
$CFLAGS_PROCESSOR_USER
\"
)"
>>
$cmake_file
echo
"set ( RRC_ASN1_VERSION
\"
${
REL
}
\"
)"
>>
$cmake_file
...
...
This diff is collapsed.
Click to expand it.
openair1/PHY/LTE_ESTIMATION/adjust_gain.c
View file @
a1347e1a
...
...
@@ -37,29 +37,9 @@ phy_adjust_gain (PHY_VARS_UE *ue, uint32_t rx_power_fil_dB, uint8_t eNB_id)
// Adjust gain in ue->rx_vars[0].rx_total_gain_dB
if
(
rx_power_fil_dB
<
TARGET_RX_POWER
-
5
)
//&& (ue->rx_total_gain_dB < MAX_RF_GAIN) )
ue
->
rx_total_gain_dB
+=
5
;
ue
->
rx_total_gain_dB
=
min
(
ue
->
rx_total_gain_dB
+
5
,
MAX_RF_GAIN
)
;
else
if
(
rx_power_fil_dB
>
TARGET_RX_POWER
+
5
)
//&& (ue->rx_total_gain_dB > MIN_RF_GAIN) )
ue
->
rx_total_gain_dB
-=
5
;
if
(
ue
->
rx_total_gain_dB
>
MAX_RF_GAIN
)
{
/*
if ((openair_daq_vars.rx_rf_mode==0) && (openair_daq_vars.mode == openair_NOT_SYNCHED)) {
openair_daq_vars.rx_rf_mode=1;
ue->rx_total_gain_dB = max(MIN_RF_GAIN,MAX_RF_GAIN-25);
}
else {
*/
ue
->
rx_total_gain_dB
=
MAX_RF_GAIN
;
}
else
if
(
ue
->
rx_total_gain_dB
<
MIN_RF_GAIN
)
{
/*
if ((openair_daq_vars.rx_rf_mode==1) && (openair_daq_vars.mode == openair_NOT_SYNCHED)) {
openair_daq_vars.rx_rf_mode=0;
ue->rx_total_gain_dB = min(MAX_RF_GAIN,MIN_RF_GAIN+25);
}
else {
*/
ue
->
rx_total_gain_dB
=
MIN_RF_GAIN
;
}
ue
->
rx_total_gain_dB
=
max
(
ue
->
rx_total_gain_dB
-
5
,
MIN_RF_GAIN
);
LOG_D
(
PHY
,
"Gain control: rx_total_gain_dB = %d (max %d,rxpf %d)
\n
"
,
ue
->
rx_total_gain_dB
,
MAX_RF_GAIN
,
rx_power_fil_dB
);
...
...
This diff is collapsed.
Click to expand it.
openair1/PHY/LTE_TRANSPORT/dci.c
View file @
a1347e1a
...
...
@@ -107,7 +107,7 @@ static uint dci_encoding(uint8_t *a,
}
uint
generate_dci0
(
uint8_t
*
dci
,
static
uint
generate_dci0
(
uint8_t
*
dci
,
uint8_t
*
eee
,
uint8_t
DCI_LENGTH
,
uint8_t
aggregation_level
,
...
...
This diff is collapsed.
Click to expand it.
openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c
View file @
a1347e1a
...
...
@@ -547,7 +547,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
ue
->
frame_parms
.
nb_antenna_ports_eNB
);
#endif
#if defined(
OAI_USRP) || defined(EXMIMO) || defined(OAI_BLADERF) || defined(OAI_LMSSDR
)
#if defined(
MANAGED_RF
)
# if DISABLE_LOG_X
printf
(
"[UE %d] Frame %d Measured Carrier Frequency %.0f Hz (offset %d Hz)
\n
"
,
ue
->
Mod_id
,
...
...
@@ -608,23 +608,14 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
LOG_I
(
PHY
,
"[UE%d] Initial sync : Estimated power: %d dB
\n
"
,
ue
->
Mod_id
,
ue
->
measurements
.
rx_power_avg_dB
[
0
]
);
#endif
#ifndef OAI_USRP
#ifndef OAI_BLADERF
#ifndef OAI_LMSSDR
#ifndef MANAGED_RF
phy_adjust_gain
(
ue
,
ue
->
measurements
.
rx_power_avg_dB
[
0
],
0
);
#endif
#endif
#endif
}
else
{
}
else
{
#ifndef OAI_USRP
#ifndef OAI_BLADERF
#ifndef OAI_LMSSDR
#ifndef MANAGED_RF
phy_adjust_gain
(
ue
,
dB_fixed
(
ue
->
measurements
.
rssi
),
0
);
#endif
#endif
#endif
}
...
...
This diff is collapsed.
Click to expand it.
openair1/SCHED_UE/phy_procedures_lte_ue.c
View file @
a1347e1a
...
...
@@ -76,7 +76,7 @@ extern double cpuf;
void
Msg1_transmitted
(
module_id_t
module_idP
,
uint8_t
CC_id
,
frame_t
frameP
,
uint8_t
eNB_id
);
void
Msg3_transmitted
(
module_id_t
module_idP
,
uint8_t
CC_id
,
frame_t
frameP
,
uint8_t
eNB_id
);
#if defined(
EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR
)
#if defined(
MANAGED_RF
)
extern
uint32_t
downlink_frequency
[
MAX_NUM_CCs
][
4
];
#endif
...
...
@@ -160,7 +160,7 @@ void dump_dlsch_SI(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t s
}
}
#if defined(
EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR
)
#if defined(
MANAGED_RF
)
//unsigned int gain_table[31] = {100,112,126,141,158,178,200,224,251,282,316,359,398,447,501,562,631,708,794,891,1000,1122,1258,1412,1585,1778,1995,2239,2512,2818,3162};
/*
unsigned int get_tx_amp_prach(int power_dBm, int power_max_dBm, int N_RB_UL)
...
...
@@ -1130,7 +1130,7 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t empt
int
subframe_tx
=
proc
->
subframe_tx
;
int
ulsch_start
;
int
overflow
=
0
;
#if defined(
EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR
)
#if defined(
MANAGED_RF
)
int
k
,
l
;
int
dummy_tx_buffer
[
frame_parms
->
samples_per_tti
]
__attribute__
((
aligned
(
16
)));
#endif
...
...
@@ -1141,7 +1141,7 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t empt
}
nsymb
=
(
frame_parms
->
Ncp
==
0
)
?
14
:
12
;
#if defined(
EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)//this is the EXPRESS MIMO case
#if defined(
MANAGED_RF)
ulsch_start
=
(
ue
->
rx_offset
+
subframe_tx
*
frame_parms
->
samples_per_tti
-
ue
->
hw_timing_advance
-
ue
->
timing_advance
-
...
...
@@ -1177,7 +1177,7 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t empt
for
(
aa
=
0
;
aa
<
frame_parms
->
nb_antennas_tx
;
aa
++
)
{
if
(
frame_parms
->
Ncp
==
1
)
PHY_ofdm_mod
(
&
ue
->
common_vars
.
txdataF
[
aa
][
subframe_tx
*
nsymb
*
frame_parms
->
ofdm_symbol_size
],
#if defined(
EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR
)
#if defined(
MANAGED_RF
)
dummy_tx_buffer
,
#else
&
ue
->
common_vars
.
txdata
[
aa
][
ulsch_start
],
...
...
@@ -1188,7 +1188,7 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t empt
CYCLIC_PREFIX
);
else
{
normal_prefix_mod
(
&
ue
->
common_vars
.
txdataF
[
aa
][
subframe_tx
*
nsymb
*
frame_parms
->
ofdm_symbol_size
],
#if defined(
EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR
)
#if defined(
MANAGED_RF
)
dummy_tx_buffer
,
#else
&
ue
->
common_vars
.
txdata
[
aa
][
ulsch_start
],
...
...
@@ -1196,7 +1196,7 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t empt
nsymb
>>
1
,
&
ue
->
frame_parms
);
normal_prefix_mod
(
&
ue
->
common_vars
.
txdataF
[
aa
][((
subframe_tx
*
nsymb
)
+
(
nsymb
>>
1
))
*
frame_parms
->
ofdm_symbol_size
],
#if defined(
EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR
)
#if defined(
MANAGED_RF
)
dummy_tx_buffer
+
(
frame_parms
->
samples_per_tti
>>
1
),
#else
&
ue
->
common_vars
.
txdata
[
aa
][
ulsch_start
+
(
frame_parms
->
samples_per_tti
>>
1
)],
...
...
@@ -1205,14 +1205,14 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t empt
&
ue
->
frame_parms
);
}
#if defined(
EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR
)
#if defined(
MANAGED_RF
)
apply_7_5_kHz
(
ue
,
dummy_tx_buffer
,
0
);
apply_7_5_kHz
(
ue
,
dummy_tx_buffer
,
1
);
#else
apply_7_5_kHz
(
ue
,
&
ue
->
common_vars
.
txdata
[
aa
][
ulsch_start
],
0
);
apply_7_5_kHz
(
ue
,
&
ue
->
common_vars
.
txdata
[
aa
][
ulsch_start
],
1
);
#endif
#if defined(
EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR
)
#if defined(
MANAGED_RF
)
overflow
=
ulsch_start
-
9
*
frame_parms
->
samples_per_tti
;
for
(
k
=
ulsch_start
,
l
=
0
;
k
<
cmin
(
frame_parms
->
samples_per_tti
*
LTE_NUMBER_OF_SUBFRAMES_PER_FRAME
,
ulsch_start
+
frame_parms
->
samples_per_tti
);
k
++
,
l
++
)
{
...
...
@@ -1310,7 +1310,7 @@ void ue_prach_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
ue
->
prach_resources
[
eNB_id
]
->
ra_TDD_map_index
,
ue
->
prach_resources
[
eNB_id
]
->
ra_RNTI
);
ue
->
tx_total_RE
[
subframe_tx
]
=
96
;
#if defined(
EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR
)
#if defined(
MANAGED_RF
)
ue
->
prach_vars
[
eNB_id
]
->
amp
=
get_tx_amp
(
ue
->
tx_power_dBm
[
subframe_tx
],
ue
->
tx_power_max_dBm
,
ue
->
frame_parms
.
N_RB_UL
,
...
...
@@ -1675,7 +1675,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
}
ue
->
tx_total_RE
[
subframe_tx
]
=
nb_rb
*
12
;
#if defined(
EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR
)
#if defined(
MANAGED_RF
)
tx_amp
=
get_tx_amp
(
ue
->
tx_power_dBm
[
subframe_tx
],
ue
->
tx_power_max_dBm
,
ue
->
frame_parms
.
N_RB_UL
,
...
...
@@ -1746,7 +1746,7 @@ void ue_srs_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8
Po_SRS
=
ue
->
tx_power_max_dBm
;
}
#if defined(
EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR
)
#if defined(
MANAGED_RF
)
if
(
ue
->
mac_enabled
==
1
)
{
tx_amp
=
get_tx_amp
(
Po_SRS
,
...
...
@@ -1995,7 +1995,7 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
ue
->
tx_power_dBm
[
subframe_tx
]
=
Po_PUCCH
;
ue
->
tx_total_RE
[
subframe_tx
]
=
12
;
#if defined(
EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR
)
#if defined(
MANAGED_RF
)
tx_amp
=
get_tx_amp
(
Po_PUCCH
,
ue
->
tx_power_max_dBm
,
ue
->
frame_parms
.
N_RB_UL
,
...
...
@@ -2076,7 +2076,7 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
ue
->
tx_power_dBm
[
subframe_tx
]
=
Po_PUCCH
;
ue
->
tx_total_RE
[
subframe_tx
]
=
12
;
#if defined(
EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR
)
#if defined(
MANAGED_RF
)
tx_amp
=
get_tx_amp
(
Po_PUCCH
,
ue
->
tx_power_max_dBm
,
ue
->
frame_parms
.
N_RB_UL
,
...
...
@@ -2320,12 +2320,8 @@ void ue_measurement_procedures(
if
((
(
slot
%
2
)
==
0
)
&&
(
l
==
(
4
-
frame_parms
->
Ncp
)))
{
// AGC
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GAIN_CONTROL
,
VCD_FUNCTION_IN
);
#ifndef OAI_USRP
#ifndef OAI_BLADERF
#ifndef OAI_LMSSDR
#ifndef MANAGED_RF
phy_adjust_gain
(
ue
,
dB_fixed
(
ue
->
measurements
.
rssi
),
0
);
#endif
#endif
#endif
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GAIN_CONTROL
,
VCD_FUNCTION_OUT
);
eNB_id
=
0
;
...
...
This diff is collapsed.
Click to expand it.
openair2/COMMON/mac_rrc_primitives.h
View file @
a1347e1a
...
...
@@ -308,88 +308,6 @@ typedef struct {
}
__attribute__
((
__packed__
))
DEFAULT_CH_MEAS
;
#define DEFAULT_eNB_MEAS_SIZE sizeof(DEFAULT_eNB_MEAS)
#ifndef OPENAIR2_IN
typedef
struct
{
//RRC_INTERFACE_FUNCTIONS
unsigned
int
Frame_index
;
unsigned
short
UE_index
[
NB_MODULES_MAX
][
NB_SIG_CNX_UE
];
uint8_t
eNB_id
[
NB_MODULES_MAX
][
NB_CNX_UE
];
// L2_ID UE_id[NB_MODULES_MAX][NB_CNX_CH];
uint8_t
UE_id
[
NB_MODULES_MAX
][
NB_CNX_CH
][
5
];
void
(
*
openair_rrc_top_init
)(
void
);
char
(
*
openair_rrc_eNB_init
)(
uint8_t
);
char
(
*
openair_rrc_UE_init
)(
uint8_t
,
uint8_t
);
RRC_status_t
(
*
rrc_rx_tx
)(
uint8_t
,
uint32_t
,
uint8_t
,
uint8_t
);
uint8_t
(
*
mac_rrc_data_ind
)(
uint8_t
,
uint32_t
,
uint16_t
,
uint8_t
*
,
uint16_t
,
eNB_flag_t
eNB_flag
,
uint8_t
eNB_index
);
uint8_t
(
*
mac_rrc_data_req
)(
uint8_t
,
uint32_t
,
uint16_t
,
uint8_t
,
uint8_t
*
,
eNB_flag_t
eNB_flag
,
uint8_t
eNB_index
);
void
(
*
mac_rrc_meas_ind
)(
uint8_t
,
MAC_MEAS_REQ_ENTRY
*
);
void
(
*
def_meas_ind
)(
uint8_t
,
uint8_t
);
void
(
*
rrc_data_indP
)
(
module_id_t
,
rb_id_t
,
sdu_size_t
,
char
*
);
void
(
*
fn_rrc
)
(
void
);
uint8_t
(
*
get_rrc_status
)(
uint8_t
Mod_id
,
uint8_t
eNB_flag
,
uint8_t
eNB_index
);
double
(
*
rrc_get_estimated_ue_distance
)
(
module_id_t
Mod_id
,
uint8_t
UE_id
,
uint8_t
CC_id
,
uint8_t
loc_type
);
}
RRC_XFACE
;
typedef
struct
{
//MAC_INTERFACE_FUNCTIONS
unsigned
int
frame
;
unsigned
short
Node_id
[
NB_MODULES_MAX
];
char
Is_cluster_head
[
NB_MODULES_MAX
];
void
(
*
macphy_exit
)(
const
char
*
);
/* Pointer function that stops the low-level scheduler due an exit condition */
unsigned
short
(
*
mac_config_req
)(
uint8_t
,
uint8_t
,
MAC_CONFIG_REQ
*
);
MAC_MEAS_REQ_ENTRY
*
(
*
mac_meas_req
)(
uint8_t
,
MAC_MEAS_REQ
*
);
void
(
*
mac_out_of_sync_ind
)(
uint8_t
,
uint32_t
,
unsigned
short
);
//RLC_INTERFACE_FUNCTIONS
void
(
*
pdcp_run
)(
void
);
void
(
*
pdcp_data_req
)(
module_id_t
,
rb_id_t
,
sdu_size_t
,
char
*
);
signed
int
(
*
rrc_rlc_config_req
)(
unsigned
int
,
unsigned
int
,
unsigned
int
,
unsigned
int
,
rlc_info_t
);
int
(
*
rrc_mac_config_req
)(
uint8_t
Mod_id
,
uint8_t
eNB_flag
,
uint8_t
UE_id
,
uint8_t
eNB_index
,
LTE_RadioResourceConfigCommonSIB_t
*
radioResourceConfigCommon
,
struct
LTE_PhysicalConfigDedicated
*
physicalConfigDedicated
,
LTE_MAC_MainConfig_t
*
mac_MainConfig
,
long
logicalChannelIdentity
,
LTE_LogicalChannelConfig_t
*
logicalChannelConfig
,
LTE_MeasGapConfig_t
*
measGapConfig
,
LTE_TDD_Config_t
*
tdd_Config
,
uint8_t
*
SIwindowsize
,
uint16_t
*
SIperiod
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
,
MBMS_flag_t
MBMS_Flag
,
struct
LTE_MBSFN_SubframeConfigList
*
mbsfn_SubframeConfigList
,
LTE_MBSFN_AreaInfoList_r9_t
*
mbsfn_AreaInfoList
,
struct
LTE_PMCH_InfoList_r9
*
pmch_InfoList
#endif
);
unsigned
int
(
*
mac_rlc_data_req
)(
module_id_t
,
unsigned
int
,
const
unsigned
int
,
char
*
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,
uint32_t
,
uint32_t
#endif
);
void
(
*
mac_rlc_data_ind
)(
module_id_t
,
logical_chan_id_t
,
char
*
,
tb_size_t
,
num_tb_t
,
crc_t
*
);
mac_rlc_status_resp_t
(
*
mac_rlc_status_ind
)
(
module_id_t
enb_mod_idP
,
module_id_t
ue_mod_idP
,
frame_t
frameP
,
sub_frame_t
subframeP
,
eNB_flag_t
eNB_flagP
,
MBMS_flag_t
MBMS_flagP
,
logical_chan_id_t
channel_idP
,
tb_size_t
tb_sizeP
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,
uint32_t
sourceL2Id
,
uint32_t
destinationL2Id
#endif
);
signed
int
(
*
rrc_rlc_data_req
)(
module_id_t
,
rb_id_t
,
mui_t
,
confirm_t
,
sdu_size_t
,
char
*
);
void
(
*
rrc_rlc_register_rrc
)
(
void
(
*
rrc_data_indP
)(
module_id_t
,
rb_id_t
,
sdu_size_t
,
char
*
),
void
(
*
rrc_data_confP
)
(
module_id_t
,
rb_id_t
,
mui_t
)
)
;
void
(
*
mrbch_phy_sync_failure
)
(
uint8_t
Mod_id
,
frame_t
frame
,
uint8_t
Free_ch_index
);
void
(
*
dl_phy_sync_success
)
(
uint8_t
Mod_id
,
frame_t
frame
,
uint8_t
eNB_index
);
}
MAC_RLC_XFACE
;
#endif
#define IDLE 0
#define NEED_RADIO_CONFIG 3
#define RADIO_CONFIG_TX 2
...
...
This diff is collapsed.
Click to expand it.
openair2/COMMON/platform_constants.h
View file @
a1347e1a
...
...
@@ -43,14 +43,6 @@
#define NL_MAX_PAYLOAD 9000
/* this should cover the max mtu size*/
#endif
#ifdef LARGE_SCALE
# define NB_MODULES_MAX 128
# define NB_NODE_MAX 128
#else
# define NB_MODULES_MAX 32
# define NB_NODE_MAX 32
#endif
#ifdef JUMBO_FRAME
# define MAX_IP_PACKET_SIZE 10000 // 9000
#else
...
...
@@ -63,9 +55,6 @@
# define MAX_IP_PACKET_SIZE 1500 // 3000
# endif
#endif
// overwrite the previous deinitions
# define MAX_MODULES NB_MODULES_MAX
#ifndef UE_EXPANSION
# ifdef LARGE_SCALE
...
...
@@ -139,8 +128,6 @@
#define UNUSED_PARAM_MBMS_SESSION_ID 0
#define UNUSED_PARAM_MBMS_SERVICE_ID 0
#define printk printf
#define UNUSED_VARIABLE(vARIABLE) (void)(vARIABLE)
#endif
/* __PLATFORM_CONSTANTS_H__ */
This diff is collapsed.
Click to expand it.
openair2/LAYER2/MAC/mac_vars.h
View file @
a1347e1a
...
...
@@ -96,7 +96,6 @@ const uint8_t cqi2fmt2x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE] = {
uint32_t
RRC_CONNECTION_FLAG
;
UE_MAC_INST
*
UE_mac_inst
;
//[NB_MODULE_MAX];
MAC_RLC_XFACE
*
Mac_rlc_xface
;
/// Primary component carrier index of eNB
int
pCC_id
[
NUMBER_OF_eNB_MAX
];
...
...
This diff is collapsed.
Click to expand it.
openair2/LAYER2/MAC/main_ue.c
View file @
a1347e1a
...
...
@@ -69,7 +69,6 @@ mac_UE_out_of_sync_ind(module_id_t module_idP, frame_t frameP,
uint16_t
eNB_index
)
{
// Mac_rlc_xface->mac_out_of_sync_ind(Mod_id, frameP, eNB_index);
}
...
...
This diff is collapsed.
Click to expand it.
openair2/LAYER2/MAC/ue_procedures.c
View file @
a1347e1a
...
...
@@ -2556,8 +2556,6 @@ ue_scheduler(const module_id_t module_idP,
#endif
//Mac_rlc_xface->frameP=frameP;
//Rrc_xface->Frame_index=Mac_rlc_xface->frameP;
//if (subframe%5 == 0)
//LG#ifdef EXMIMO
pdcp_run
(
&
ctxt
);
...
...
This diff is collapsed.
Click to expand it.
openair2/LAYER2/PDCP_v10.1.0/pdcp.h
View file @
a1347e1a
...
...
@@ -380,8 +380,10 @@ int pdcp_module_init (void);
void
pdcp_module_cleanup
(
void
);
void
pdcp_layer_init
(
void
);
void
pdcp_layer_cleanup
(
void
);
#if defined(PDCP_USE_NETLINK_QUEUES)
int
pdcp_netlink_init
(
void
);
#endif
#define PDCP2NW_DRIVER_FIFO 21
#define NW_DRIVER2PDCP_FIFO 22
...
...
This diff is collapsed.
Click to expand it.
openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c
View file @
a1347e1a
...
...
@@ -70,6 +70,7 @@ extern struct iovec nas_iov_rx;
extern
int
nas_sock_fd
;
extern
struct
msghdr
nas_msg_rx
;
#if defined(PDCP_USE_NETLINK_QUEUES)
static
pthread_t
pdcp_netlink_thread
;
/* We use lock-free queues between the User-plane driver running in kernel-space
...
...
@@ -292,3 +293,4 @@ void *pdcp_netlink_thread_fct(void *arg)
return
NULL
;
}
#endif
This diff is collapsed.
Click to expand it.
openair2/LAYER2/openair2_proc.c
View file @
a1347e1a
...
...
@@ -417,15 +417,9 @@ int openair2_stats_read(char *buffer, char **my_buffer, off_t off, int length)
// if (mac_xface->is_cluster_head == 0) {
for
(
k
=
0
;
k
<
NB_INST
;
k
++
)
{
if
(
Mac_rlc_xface
->
Is_cluster_head
[
k
]
==
0
)
{
#ifndef PHY_EMUL_ONE_MACHINE
Mod_id
=
k
-
NB_CH_INST
;
len
+=
sprintf
(
&
buffer
[
len
],
"UE TTI: %d
\n
"
,
Mac_rlc_xface
->
frame
);
for
(
CH_index
=
0
;
CH_index
<
NB_CNX_UE
;
CH_index
++
)
{
...
...
@@ -554,126 +548,6 @@ int openair2_stats_read(char *buffer, char **my_buffer, off_t off, int length)
}
#endif //PHY_EMUL_ONE_MACHINE
}
else
if
(
Mac_rlc_xface
->
Is_cluster_head
[
k
]
==
1
)
{
Mod_id
=
k
;
len
+=
sprintf
(
&
buffer
[
len
],
"-------------------------------------------------------------------CH %d: TTI: %d------------------------------------------------------------------
\n
"
,
NODE_ID
[
Mod_id
],
Mac_rlc_xface
->
frame
);
for
(
i
=
1
;
i
<=
NB_CNX_CH
;
i
++
)
{
if
(
CH_mac_inst
[
Mod_id
].
Dcch_lchan
[
i
].
Active
==
1
)
{
len
+=
sprintf
(
&
buffer
[
len
],
"
\n
MR index %d: DL SINR (feedback) %d dB, CQI: %s
\n\n
"
,
i
,
//CH_rrc_inst[Mod_id].Info.UE_list[i].L2_id[0],
CH_mac_inst
[
Mod_id
].
Def_meas
[
i
].
Wideband_sinr
,
print_cqi
(
CH_mac_inst
[
Mod_id
].
Def_meas
[
i
].
cqi
));
len
+=
sprintf
(
&
buffer
[
len
],
"[MAC] LCHAN %d (DCCH), NB_TX_MAC= %d (%d bits/TTI, %d kbits/s), NB_RX_MAC= %d (errors %d, sacch errors %d, sach errors %d, sach_missing %d)
\n\n
"
,
CH_mac_inst
[
Mod_id
].
Dcch_lchan
[
i
].
Lchan_info
.
Lchan_id
.
Index
,
CH_mac_inst
[
Mod_id
].
Dcch_lchan
[
i
].
Lchan_info
.
NB_TX
,
CH_mac_inst
[
Mod_id
].
Dcch_lchan
[
i
].
Lchan_info
.
output_rate
,
(
10
*
CH_mac_inst
[
Mod_id
].
Dcch_lchan
[
i
].
Lchan_info
.
output_rate
)
>>
5
,
CH_mac_inst
[
Mod_id
].
Dcch_lchan
[
i
].
Lchan_info
.
NB_RX
,
CH_mac_inst
[
Mod_id
].
Dcch_lchan
[
i
].
Lchan_info
.
NB_RX_ERRORS
,
CH_mac_inst
[
Mod_id
].
Dcch_lchan
[
i
].
Lchan_info
.
NB_RX_SACCH_ERRORS
,
CH_mac_inst
[
Mod_id
].
Dcch_lchan
[
i
].
Lchan_info
.
NB_RX_SACH_ERRORS
,
CH_mac_inst
[
Mod_id
].
Dcch_lchan
[
i
].
Lchan_info
.
NB_RX_SACH_MISSING
);
for
(
j
=
0
;
j
<
NB_RAB_MAX
;
j
++
)
{
if
(
CH_mac_inst
[
Mod_id
].
Dtch_lchan
[
j
][
i
].
Active
==
1
)
{
Overhead
=
CH_mac_inst
[
Mod_id
].
Dtch_lchan
[
j
][
i
].
Lchan_info
.
output_rate
-
Pdcp_stats_tx_rate
[
k
][
i
][
j
];
if
(
Overhead
<
0
)
{
Overhead
=-
Overhead
;
Sign
=-
1
;
}
else
{
Sign
=
1
;
}
len
+=
sprintf
(
&
buffer
[
len
],
"[PDCP]LCHAN %d: NB_TX = %d ,Tx_rate =(%d bits/TTI ,%d Kbits/s), NB_RX = %d ,Rx_rate =(%d bits/TTI ,%d Kbits/s), LAYER2 TX OVERHEAD= %d Kbits/s
\n
"
,
CH_mac_inst
[
Mod_id
].
Dtch_lchan
[
j
][
i
].
Lchan_info
.
Lchan_id
.
Index
,
Pdcp_stats_tx
[
k
][
i
][
j
],
Pdcp_stats_tx_rate
[
k
][
i
][
j
],
(
10
*
Pdcp_stats_tx_rate
[
k
][
i
][
j
])
>>
5
,
Pdcp_stats_rx
[
k
][
i
][
j
],
Pdcp_stats_rx_rate
[
k
][
i
][
j
],
(
10
*
Pdcp_stats_rx_rate
[
k
][
i
][
j
])
>>
5
,
Sign
*
(
10
*
Overhead
)
>>
5
);
int
status
=
rlc_stat_req
(
k
,
CH_mac_inst
[
Mod_id
].
Dtch_lchan
[
j
][
i
].
Lchan_info
.
Lchan_id
.
Index
,
&
tx_pdcp_sdu
,
&
tx_pdcp_sdu_discarded
,
&
tx_retransmit_pdu_unblock
,
&
tx_retransmit_pdu_by_status
,
&
tx_retransmit_pdu
,
&
tx_data_pdu
,
&
tx_control_pdu
,
&
rx_sdu
,
&
rx_error_pdu
,
&
rx_data_pdu
,
&
rx_data_pdu_out_of_window
,
&
rx_control_pdu
)
;
/*
if (status == RLC_OP_STATUS_OK) {
len+=sprintf(&buffer[len],"\t[RLC] LCHAN %d, NB_SDU_TO_TX = %d\tNB_SDU_DISC %d\tNB_RX_SDU %d\n",
CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.Lchan_id.Index,
tx_pdcp_sdu,
tx_pdcp_sdu_discarded,
rx_sdu);
len+=sprintf(&buffer[len],"\t[RLC] LCHAN %d, NB_TB_TX_DATA = %d\tNB_TB_TX_CONTROL %d\tNB_TX_TB_RETRANS %\n",
CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.Lchan_id.Index,
tx_data_pdu,
tx_control_pdu,
tx_retransmit_pdu);
len+=sprintf(&buffer[len],"\t[RLC] LCHAN %d, NB_TX_TB_RETRANS_BY_STATUS = %d\tNB_TX_TB_RETRANS_PADD %d\n",
CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.Lchan_id.Index,
tx_retransmit_pdu_by_status,
tx_retransmit_pdu_unblock);
len+=sprintf(&buffer[len],"\t[RLC] LCHAN %d, NB_RX_DATA = %d\tNB_RX_TB_OUT_WIN %d\tNB_RX_TB_CORRUPT %d\n",
CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.Lchan_id.Index,
rx_data_pdu,
rx_data_pdu_out_of_window,
rx_error_pdu);
}
*/
len
+=
sprintf
(
&
buffer
[
len
],
"[MAC]LCHAN %d (CNX %d,RAB %d), NB_TX_MAC= %d (%d bits/TTI, %d kbit/s), NB_RX_MAC= %d (errors %d, sacch_errors %d, sach_errors %d, sach_missing %d)
\n
"
,
CH_mac_inst
[
Mod_id
].
Dtch_lchan
[
j
][
i
].
Lchan_info
.
Lchan_id
.
Index
,
i
,
j
,
CH_mac_inst
[
Mod_id
].
Dtch_lchan
[
j
][
i
].
Lchan_info
.
NB_TX
,
CH_mac_inst
[
Mod_id
].
Dtch_lchan
[
j
][
i
].
Lchan_info
.
output_rate
,
(
10
*
CH_mac_inst
[
Mod_id
].
Dtch_lchan
[
j
][
i
].
Lchan_info
.
output_rate
)
>>
5
,
CH_mac_inst
[
Mod_id
].
Dtch_lchan
[
j
][
i
].
Lchan_info
.
NB_RX
,
CH_mac_inst
[
Mod_id
].
Dtch_lchan
[
j
][
i
].
Lchan_info
.
NB_RX_ERRORS
,
CH_mac_inst
[
Mod_id
].
Dtch_lchan
[
j
][
i
].
Lchan_info
.
NB_RX_SACCH_ERRORS
,
CH_mac_inst
[
Mod_id
].
Dtch_lchan
[
j
][
i
].
Lchan_info
.
NB_RX_SACH_ERRORS
,
CH_mac_inst
[
Mod_id
].
Dtch_lchan
[
j
][
i
].
Lchan_info
.
NB_RX_SACH_MISSING
);
len
+=
sprintf
(
&
buffer
[
len
],
"[MAC][SCHEDULER] TX Arrival Rate %d, TX Service Rate %d, RX Arrival rate %d, RX Service rate %d, NB_BW_REQ_RX %d
\n\n
"
,
CH_mac_inst
[
Mod_id
].
Dtch_lchan
[
j
][
i
].
Lchan_info
.
Arrival_rate
,
CH_mac_inst
[
Mod_id
].
Dtch_lchan
[
j
][
i
].
Lchan_info
.
Tx_rate
,
CH_mac_inst
[
Mod_id
].
Dtch_lchan
[
j
][
i
].
Lchan_info
.
Req_rate
,
CH_mac_inst
[
Mod_id
].
Dtch_lchan
[
j
][
i
].
Lchan_info
.
Rx_rate
,
CH_mac_inst
[
Mod_id
].
Dtch_lchan
[
j
][
i
].
Lchan_info
.
NB_BW_REQ_RX
);
/*
len+=sprintf(&buffer[len]," TX per TB: ");
for(kk=0;kk<MAX_NUMBER_TB_PER_LCHAN/2;kk++)
len+=sprintf(&buffer[len],"%d.",CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.NB_TX_TB[kk]);
len+=sprintf(&buffer[len],"\n");
len+=sprintf(&buffer[len]," RXerr per TB: ");
for(kk=0;kk<MAX_NUMBER_TB_PER_LCHAN/2;kk++)
len+=sprintf(&buffer[len],"%d/%d . ",CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.NB_RX_ERRORS_TB[kk],
CH_mac_inst[Mod_id].Dtch_lchan[j][i].Lchan_info.NB_RX_TB[kk]);
len+=sprintf(&buffer[len],"\n");
*/
}
}
}
}
}
}
return
len
;
...
...
This diff is collapsed.
Click to expand it.
openair2/LAYER2/register.h
deleted
100644 → 0
View file @
11fd202d
/*
* 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
*/
/*________________________rrc_register.h________________________
Authors : Hicham Anouar, Raymond Knopp
Company : EURECOM
Emails : anouar@eurecom.fr, knopp@eurecom.fr
________________________________________________________________*/
#ifndef __MAC_RRC_REGISTER_H__
# define __MAC_RRC_REGISTER_H__
#include "COMMON/mac_rrc_primitives.h"
/** @defgroup _mac_impl_register RRC Registration interface
* @ingroup _mac_impl_
*@{
*/
MAC_RLC_XFACE
*
mac_rrc_register
(
RRC_XFACE
*
RRC_xface
);
int
mac_rrc_unregister
(
RRC_XFACE
*
RRC_xface
);
#endif
This diff is collapsed.
Click to expand it.
openair2/NETWORK_DRIVER/UE_IP/device.c
View file @
a1347e1a
...
...
@@ -349,7 +349,7 @@ static const struct net_device_ops ue_ip_netdev_ops = {
.
ndo_set_mac_address
=
ue_ip_set_mac_address
,
.
ndo_set_config
=
ue_ip_set_config
,
.
ndo_do_ioctl
=
NULL
,
#if
RHEL_RELEASE_CODE>=
1797
#if
defined RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >=
1797
.
extended
.
ndo_change_mtu
=
ue_ip_change_mtu
,
#else
.
ndo_change_mtu
=
ue_ip_change_mtu
,
...
...
This diff is collapsed.
Click to expand it.
openair2/NETWORK_DRIVER/UE_IP/local.h
View file @
a1347e1a
...
...
@@ -57,7 +57,6 @@
#include "platform_types.h"
#include "sap.h"
#define MAKE_VERSION(a,b,c) ((a)*256+(b)*16+(c))
typedef
struct
ue_ip_priv_s
{
int
irq
;
...
...
This diff is collapsed.
Click to expand it.
openair2/PHY_INTERFACE/IF_Module.c
View file @
a1347e1a
...
...
@@ -610,7 +610,7 @@ void UL_indication(UL_IND_t *UL_info)
IF_Module_t
*
IF_Module_init
(
int
Mod_id
){
AssertFatal
(
Mod_id
<
MAX_MODULES
,
"Asking for Module %d > %d
\n
"
,
Mod_id
,
MAX_IF_MODULES
);
AssertFatal
(
Mod_id
==
0
,
"Asking for Module %d > %d
\n
"
,
Mod_id
,
MAX_IF_MODULES
);
LOG_D
(
PHY
,
"Installing callbacks for IF_Module - UL_indication
\n
"
);
...
...
@@ -629,7 +629,7 @@ IF_Module_t *IF_Module_init(int Mod_id){
void
IF_Module_kill
(
int
Mod_id
)
{
AssertFatal
(
Mod_id
>
MAX_MODULES
,
"Asking for Module %d > %d
\n
"
,
Mod_id
,
MAX_IF_MODULES
);
AssertFatal
(
Mod_id
==
0
,
"Asking for Module %d > %d
\n
"
,
Mod_id
,
MAX_IF_MODULES
);
if
(
if_inst
[
Mod_id
]
!=
NULL
)
free
(
if_inst
[
Mod_id
]);
}
This diff is collapsed.
Click to expand it.
openair2/RRC/LTE/rrc_UE.c
View file @
a1347e1a
...
...
@@ -921,11 +921,6 @@ rrc_ue_establish_drb(
//-----------------------------------------------------------------------------
{
// add descriptor from RRC PDU
int
oip_ifup
=
0
,
ip_addr_offset3
=
0
,
ip_addr_offset4
=
0
;
/* avoid gcc warnings */
(
void
)
oip_ifup
;
(
void
)
ip_addr_offset3
;
(
void
)
ip_addr_offset4
;
LOG_I
(
RRC
,
"[UE %d] Frame %d: processing RRCConnectionReconfiguration: reconfiguring DRB %ld/LCID %d
\n
"
,
ue_mod_idP
,
frameP
,
DRB_config
->
drb_Identity
,
(
int
)
*
DRB_config
->
logicalChannelIdentity
);
...
...
@@ -938,12 +933,12 @@ rrc_ue_establish_drb(
RADIO_ACCESS_BEARER,Rlc_info_um);
*/
#ifdef PDCP_USE_NETLINK
# if !defined(OAI_NW_DRIVER_TYPE_ETHERNET) && !defined(
EXMIMO) && !defined(OAI_USRP) && !defined(OAI_BLADE
RF) && !defined(ETHERNET) && !defined(LINK_ENB_PDCP_TO_GTPV1U)
ip_addr_offset3
=
0
;
ip_addr_offset4
=
1
;
# if !defined(OAI_NW_DRIVER_TYPE_ETHERNET) && !defined(
MANAGED_
RF) && !defined(ETHERNET) && !defined(LINK_ENB_PDCP_TO_GTPV1U)
i
nt
i
p_addr_offset3
=
0
;
i
nt
i
p_addr_offset4
=
1
;
LOG_I
(
OIP
,
"[UE %d] trying to bring up the OAI interface oai%d, IP 10.0.%d.%d
\n
"
,
ue_mod_idP
,
ip_addr_offset3
+
ue_mod_idP
,
ip_addr_offset3
+
ue_mod_idP
+
1
,
ip_addr_offset4
+
ue_mod_idP
+
1
);
oip_ifup
=
nas_config
(
ip_addr_offset3
+
ue_mod_idP
,
// interface_id
int
oip_ifup
=
nas_config
(
ip_addr_offset3
+
ue_mod_idP
,
// interface_id
ip_addr_offset3
+
ue_mod_idP
+
1
,
// third_octet
ip_addr_offset4
+
ue_mod_idP
+
1
);
// fourth_octet
...
...
This diff is collapsed.
Click to expand it.
openair2/RRC/LTE/rrc_eNB.c
View file @
a1347e1a
...
...
@@ -4917,11 +4917,6 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
//-----------------------------------------------------------------------------
{
int
i
,
drb_id
;
int
oip_ifup
=
0
;
int
dest_ip_offset
=
0
;
/* avoid gcc warnings */
(
void
)
oip_ifup
;
(
void
)
dest_ip_offset
;
uint8_t
*
kRRCenc
=
NULL
;
uint8_t
*
kRRCint
=
NULL
;
uint8_t
*
kUPenc
=
NULL
;
...
...
@@ -5045,18 +5040,19 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
ctxt_pP
->
module_id
,
ctxt_pP
->
frame
,
(
int
)
DRB_configList
->
list
.
array
[
i
]
->
drb_Identity
);
#if defined(PDCP_USE_NETLINK) && !defined(LINK_ENB_PDCP_TO_GTPV1U)
// can mean also IPV6 since ether -> ipv6 autoconf
# if !defined(OAI_NW_DRIVER_TYPE_ETHERNET) && !defined(EXMIMO) && !defined(OAI_USRP) && !defined(OAI_BLADERF) && !defined(ETHERNET)
LOG_I
(
OIP
,
"[eNB %d] trying to bring up the OAI interface oai%d
\n
"
,
# if !defined(OAI_NW_DRIVER_TYPE_ETHERNET) && !defined(MANAGED_RF) && !defined(ETHERNET)
LOG_I
(
OIP
,
"[eNB %d] trying to bring up the OAI interface oai%d
\n
"
,
ctxt_pP
->
module_id
,
ctxt_pP
->
module_id
);
oip_ifup
=
nas_config
(
int
oip_ifup
=
nas_config
(
ctxt_pP
->
module_id
,
// interface index
ctxtReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA_pP
->
module_id
+
1
,
// thrid octet
ctxt_pP
->
module_id
+
1
);
// fourth octet
if
(
oip_ifup
==
0
)
{
// interface is up --> send a config the DRB
module_id_t
ue_module_id
;
dest_ip_offset
=
8
;
int
dest_ip_offset
=
8
;
LOG_I
(
OIP
,
"[eNB %d] Config the oai%d to send/receive pkt on DRB %ld to/from the protocol stack
\n
"
,
ctxt_pP
->
module_id
,
ctxt_pP
->
module_id
,
...
...
This diff is collapsed.
Click to expand it.
openair2/RRC/LTE/rrm_2_rrc_msg.c
deleted
100644 → 0
View file @
11fd202d
/*
* 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 emul_interface.c
\brief RRM interface emulation, it sends message to the RRM interface
- RRC -> RRM
- CMM -> RRM
\author BURLOT Pascal
\date 10/07/08
\par Historique:
$Author$ $Date$ $Revision$
$Id$
$Log$
*******************************************************************************
*/
#include "defs.h"
#include "extern.h"
//#include "mac_lchan_interface.h"
//#include "openair_rrc_utils.h"
//#include "openair_rrc_main.h"
#ifdef PHY_EMUL
#include "SIMULATION/simulation_defs.h"
extern
EMULATION_VARS
*
Emul_vars
;
extern
CH_MAC_INST
*
CH_mac_inst
;
extern
UE_MAC_INST
*
UE_mac_inst
;
#endif
/******************************************************************************/
void
fn_rrc
(
void
)
{
/******************************************************************************/
msg_head_t
*
Header
;
char
*
Data
;
L2_ID
Mac_id
;
while
(
1
)
{
Header
=
(
msg_head_t
*
)
recv_msg
(
&
S_rrc
)
;
if
(
Header
==
NULL
)
{
break
;
}
Data_to_read
=
Header
->
size
;
if
(
Data_to_read
>
0
)
{
Data
=
(
char
*
)
(
Header
+
1
)
;
}
msg
(
"Got MSG of Type %d on Inst %d
\n
"
,
Header
->
msg_type
,
Header
->
inst
);
switch
(
Header
->
msg_type
)
{
case
RRM_INIT_CH_REQ
:
{
rrm_init_ch_req_t
*
p
=
(
rrm_init_ch_req_t
*
)
Data
;
msg
(
"[RRM]>[RRC][Inst %d]:RRM_INIT_CH_REQ
\n
"
,
Header
->
inst
);
rrc_init_ch_req
(
Header
->
inst
,
p
);
break
;
}
case
RRCI_INIT_MR_REQ
:
{
rrci_init_mr_req_t
*
p
=
(
rrci_init_mr_req_t
*
)
Data
;
msg
(
"[RRM]>[RRC][Inst %d]:RRCI_INIT_MR_REQ
\n
"
,
Header
->
inst
);
rrc_init_mr_req
(
Header
->
inst
,
p
);
break
;
}
case
RRM_RB_ESTABLISH_REQ
:
{
send_msg
((
void
*
)
&
S_rrc
,
msg_rrc_rb_establish_resp
(
Header
->
inst
,
Header
->
Trans_id
));
msg
(
"[RRM]>[RRC][Inst %d]:RRM_RB_ESTABLISH_REQ, size %d
\n
"
,
Header
->
inst
,
sizeof
(
rrm_rb_establish_req_t
));
rrc_config_req
(
Header
->
inst
,(
void
*
)
Data
,
Header
->
msg_type
,
Header
->
Trans_id
);
break
;
}
case
RRM_RB_MODIFY_REQ
:
{
send_msg
((
void
*
)
&
S_rrc
,
msg_rrc_rb_modify_resp
(
Header
->
inst
,
Header
->
Trans_id
));
msg
(
"[RRM]>[RRC][Inst %d]:RRM_RB_MODIFY_REQ
\n
"
,
Header
->
inst
);
rrc_config_req
(
Header
->
inst
,
Data
,
Header
->
msg_type
,
Header
->
Trans_id
);
}
case
RRM_RB_RELEASE_REQ
:
{
send_msg
((
void
*
)
&
S_rrc
,
msg_rrc_rb_release_resp
(
Header
->
inst
,
Header
->
Trans_id
));
msg
(
"[RRM]>[RRC][Inst %d]:RRM_RB_RELEASE_REQ
\n
"
,
Header
->
inst
);
rrc_config_req
(
Header
->
inst
,
Data
,
Header
->
msg_type
,
Header
->
Trans_id
);
}
case
RRCI_CX_ESTABLISH_RESP
:
{
rrci_cx_establish_resp_t
*
p
=
(
rrci_cx_establish_resp_t
*
)
Data
;
unsigned
char
CH_index
,
i
;
msg
(
"[RRCI]>[RRC][Inst %d]:RRCI_CX_ESTABLISH_RESP
\n
"
,
Header
->
inst
);
for
(
i
=
0
;
i
<
NB_SIG_CNX_UE
;
i
++
)
if
(
!
bcmp
(
&
UE_rrc_inst
[
Header
->
inst
-
NB_CH_INST
].
Info
[
i
].
CH_mac_id
,
&
p
->
L2_id
,
sizeof
(
L2_ID
)))
{
CH_index
=
i
;
break
;
}
if
(
i
==
NB_SIG_CNX_UE
)
{
msg
(
"[RRC] FATAL: CH_INDEX NOT FOUND
\n
"
);
return
;
}
UE_rrc_inst
[
Header
->
inst
-
NB_CH_INST
].
Srb2
[
CH_index
].
Srb_info
.
IP_addr_type
=
p
->
L3_info_t
;
if
(
p
->
L3_info_t
==
IPv4_ADDR
)
{
memcpy
(
&
UE_rrc_inst
[
Header
->
inst
-
NB_CH_INST
].
Srb2
[
CH_index
].
Srb_info
.
IP_addr
,
p
->
L3_info
,
4
);
}
else
{
memcpy
(
&
UE_rrc_inst
[
Header
->
inst
-
NB_CH_INST
].
Srb2
[
CH_index
].
Srb_info
.
IP_addr
,
p
->
L3_info
,
16
);
}
}
break
;
case
RRM_SENSING_MEAS_REQ
:
{
// rrm_sensing_meas_req_t *p = (rrm_sensing_meas_req_t *) sock_msg ;
send_msg
((
void
*
)
&
S_rrc
,
msg_rrc_sensing_meas_resp
(
Header
->
inst
,
Header
->
Trans_id
));
msg
(
"[RRM]>[RRC][Inst %d]:RRM_SENSING_MEAS_REQ
\n
"
,
Header
->
inst
);
// rrc_meas_req(header->inst,p,RRC_MEAS_ADD);
}
break
;
case
RRM_SENSING_MEAS_RESP
:
{
msg
(
"[RRM]>[RRC][Inst %d]:RRM_SENSING_MEAS_RESP
\n
"
,
Header
->
inst
);
//rrm_rrc_meas_resp(header->inst,header->Trans_id);
}
break
;
case
RRM_SCAN_ORD
:
msg
(
"[RRM]>[RRC][Inst %d]:RRM_SCAN_ORD
\n
"
,
Header
->
inst
);
//memcpy(&CH_rrc_inst[0].Rrm_init_scan_req,(rrm_init_scan_req_t *) Data,sizeof(rrm_init_scan_req_t));
//CH_rrc_inst[0].Last_scan_req=Rrc_xface->Frame_index;
///send over air
break
;
case
RRM_INIT_SCAN_REQ
:
msg
(
"[RRM]>[RRC][Inst %d]:RRM_INIT_SCAN_REQ
\n
"
,
Header
->
inst
);
memcpy
(
&
CH_rrc_inst
[
0
].
Rrm_init_scan_req
,(
rrm_init_scan_req_t
*
)
Data
,
sizeof
(
rrm_init_scan_req_t
));
CH_rrc_inst
[
0
].
Last_scan_req
=
Rrc_xface
->
Frame_index
;
///send over air
break
;
case
RRM_END_SCAN_REQ
:
msg
(
"[RRM]>[RRC][Inst %d]:RRM_END_SCAN_REQ
\n
"
,
Header
->
inst
);
memcpy
(
&
Mac_id
.
L2_id
[
0
],
Data
,
sizeof
(
L2_ID
));
unsigned
char
UE_index
=
Mac_id
.
L2_id
[
0
]
-
NB_CH_MAX
+
1
;
UE_rrc_inst
[
0
].
Srb2
[
UE_index
].
Srb_info
.
Tx_buffer
.
Payload
[
0
]
=
100
;
msg
(
"SRB_ID %d
\n
"
,
CH_rrc_inst
[
0
].
Srb2
[
UE_index
].
Srb_info
.
Srb_id
);
Mac_rlc_xface
->
rrc_rlc_data_req
(
0
,
CH_rrc_inst
[
0
].
Srb2
[
UE_index
].
Srb_info
.
Srb_id
,
0
,
0
,
1
,
CH_rrc_inst
[
0
].
Srb2
[
UE_index
].
Srb_info
.
Tx_buffer
.
Payload
);
//CH_rrc_inst[0].Last_scan_req=Rrc_xface->Frame_index;
///send over air
break
;
default
:
msg
(
"[L3_xface]WARNING: msg unknown %d
\n
"
,
Header
->
msg_type
)
;
}
}
}
This diff is collapsed.
Click to expand it.
openair2/RRC/LTE/utils.c
View file @
a1347e1a
...
...
@@ -52,8 +52,7 @@ uint16_t find_free_dtch_position(uint8_t Mod_id, uint16_t UE_CH_index)
}
msg
(
"NO FREE DTCH LCHAN, exit...
\n
"
);
Mac_rlc_xface
->
macphy_exit
(
"NO FREE DTCH LCHAN, exit"
);
exit
(
1
);
return
0
;
}
...
...
This diff is collapsed.
Click to expand it.
targets/ARCH/tcp_bridge/tcp_bridge_oai.c
View file @
a1347e1a
...
...
@@ -6,447 +6,296 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdbool.h>
#include <errno.h>
#include <sys/epoll.h>
#include <string.h>
#include <common/utils/assertions.h>
#include <common/utils/LOG/log.h>
#include "common_lib.h"
#include <openair1/PHY/defs_eNB.h>
#include "openair1/PHY/defs_UE.h"
#define PORT 4043 //TCP port for this simulator
#define CirSize 3072000 // 100ms is enough
#define sample_t uint32_t // 2*16 bits complex number
#define sampleToByte(a,b) ((a)*(b)*sizeof(sample_t))
#define byteToSample(a,b) ((a)/(sizeof(sample_t)*(b)))
#define MAGICeNB 0xA5A5A5A5A5A5A5A5
#define MAGICUE 0x5A5A5A5A5A5A5A5A
typedef
struct
{
uint64_t
magic
;
uint32_t
size
;
uint32_t
nbAnt
;
uint64_t
timestamp
;
}
transferHeader
;
typedef
struct
buffer_s
{
int
conn_sock
;
bool
alreadyWrote
;
uint64_t
lastReceivedTS
;
bool
headerMode
;
transferHeader
th
;
char
*
transferPtr
;
uint64_t
remainToTransfer
;
char
*
circularBufEnd
;
sample_t
*
circularBuf
;
}
buffer_t
;
typedef
struct
{
int
listen_sock
,
epollfd
;
uint64_t
nextTimestamp
;
uint64_t
typeStamp
;
char
*
ip
;
buffer_t
buf
[
FD_SETSIZE
];
}
tcp_bridge_state_t
;
void
allocCirBuf
(
tcp_bridge_state_t
*
bridge
,
int
sock
)
{
buffer_t
*
ptr
=&
bridge
->
buf
[
sock
];
AssertFatal
(
(
ptr
->
circularBuf
=
(
sample_t
*
)
malloc
(
sampleToByte
(
CirSize
,
1
)))
!=
NULL
,
""
);
ptr
->
circularBufEnd
=
((
char
*
)
ptr
->
circularBuf
)
+
sampleToByte
(
CirSize
,
1
);
ptr
->
conn_sock
=
sock
;
ptr
->
headerMode
=
true
;
ptr
->
transferPtr
=
(
char
*
)
&
ptr
->
th
;
ptr
->
remainToTransfer
=
sizeof
(
transferHeader
);
int
sendbuff
=
1000
*
1000
*
10
;
AssertFatal
(
setsockopt
(
sock
,
SOL_SOCKET
,
SO_SNDBUF
,
&
sendbuff
,
sizeof
(
sendbuff
))
==
0
,
""
);
struct
epoll_event
ev
=
{
0
};
ev
.
events
=
EPOLLIN
|
EPOLLRDHUP
;
ev
.
data
.
fd
=
sock
;
AssertFatal
(
epoll_ctl
(
bridge
->
epollfd
,
EPOLL_CTL_ADD
,
sock
,
&
ev
)
!=
-
1
,
""
);
}
void
removeCirBuf
(
tcp_bridge_state_t
*
bridge
,
int
sock
)
{
AssertFatal
(
epoll_ctl
(
bridge
->
epollfd
,
EPOLL_CTL_DEL
,
sock
,
NULL
)
!=
-
1
,
""
);
close
(
sock
);
free
(
bridge
->
buf
[
sock
].
circularBuf
);
memset
(
&
bridge
->
buf
[
sock
],
0
,
sizeof
(
buffer_t
));
bridge
->
buf
[
sock
].
conn_sock
=-
1
;
int
fullread
(
int
fd
,
void
*
_buf
,
int
count
)
{
char
*
buf
=
_buf
;
int
ret
=
0
;
int
l
;
while
(
count
)
{
l
=
read
(
fd
,
buf
,
count
);
if
(
l
<=
0
)
return
-
1
;
count
-=
l
;
buf
+=
l
;
ret
+=
l
;
}
return
ret
;
}
#define helpTxt "\
\x1b[31m\
tcp_bridge: error: you have to run one UE and one eNB\n\
For this, export TCPBRIDGE=enb (eNB case) or \n\
TCPBRIDGE=<an ip address> (UE case)\n\
\x1b[m"
int
fullwrite
(
int
fd
,
void
*
_buf
,
int
count
)
{
int
fullwrite
(
int
fd
,
void
*
_buf
,
int
count
)
{
char
*
buf
=
_buf
;
int
ret
=
0
;
int
l
;
while
(
count
)
{
l
=
write
(
fd
,
buf
,
count
);
if
(
l
<=
0
)
{
if
(
errno
==
EAGAIN
||
errno
==
EINTR
)
continue
;
else
return
-
1
;
}
if
(
l
<=
0
)
return
-
1
;
count
-=
l
;
buf
+=
l
;
ret
+=
l
;
}
return
ret
;
}
enum
blocking_t
{
blocking
,
notBlocking
};
void
setblocking
(
int
sock
,
enum
blocking_t
active
)
{
int
opts
;
AssertFatal
(
(
opts
=
fcntl
(
sock
,
F_GETFL
))
>=
0
,
""
);
#include "common_lib.h"
if
(
active
==
blocking
)
opts
=
opts
&
~
O_NONBLOCK
;
else
opts
=
opts
|
O_NONBLOCK
;
typedef
struct
{
int
sock
;
int
samples_per_subframe
;
uint64_t
timestamp
;
uint64_t
next_tx_timestamp
;
int
is_enb
;
}
tcp_bridge_state_t
;
AssertFatal
(
fcntl
(
sock
,
F_SETFL
,
opts
)
>=
0
,
""
);
void
verify_connection
(
int
fd
,
int
is_enb
)
{
char
c
=
is_enb
;
if
(
fullwrite
(
fd
,
&
c
,
1
)
!=
1
)
exit
(
1
);
if
(
fullread
(
fd
,
&
c
,
1
)
!=
1
)
exit
(
1
);
if
(
c
==
is_enb
)
{
printf
(
"
\x1b
[31mtcp_bridge: error: you have to run one UE and one eNB"
" (did you run 'export ENODEB=1' in the eNB terminal?)
\x1b
[m
\n
"
);
exit
(
1
);
}
}
int
tcp_bridge_start
(
openair0_device
*
device
)
{
int
port
=
4043
;
tcp_bridge_state_t
*
tcp_bridge
=
device
->
priv
;
int
try
;
int
max_try
=
5
;
tcp_bridge_state_t
*
init_bridge
(
openair0_device
*
device
)
{
tcp_bridge_state_t
*
tcp_bridge
;
if
(
device
->
priv
)
tcp_bridge
=
(
tcp_bridge_state_t
*
)
device
->
priv
;
else
AssertFatal
(((
tcp_bridge
=
(
tcp_bridge_state_t
*
)
calloc
(
sizeof
(
tcp_bridge_state_t
),
1
)))
!=
NULL
,
""
);
for
(
int
i
=
0
;
i
<
FD_SETSIZE
;
i
++
)
tcp_bridge
->
buf
[
i
].
conn_sock
=-
1
;
device
->
priv
=
tcp_bridge
;
AssertFatal
((
tcp_bridge
->
epollfd
=
epoll_create1
(
0
))
!=
-
1
,
""
);
return
tcp_bridge
;
}
int
sock
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
if
(
sock
==
-
1
)
{
perror
(
"tcp_bridge: socket"
);
exit
(
1
);
}
int
server_start
(
openair0_device
*
device
)
{
tcp_bridge_state_t
*
t
=
init_bridge
(
device
);
t
->
typeStamp
=
MAGICeNB
;
AssertFatal
((
t
->
listen_sock
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
))
>=
0
,
""
);
int
enable
=
1
;
AssertFatal
(
setsockopt
(
t
->
listen_sock
,
SOL_SOCKET
,
SO_REUSEADDR
,
&
enable
,
sizeof
(
int
))
==
0
,
""
);
if
(
setsockopt
(
sock
,
SOL_SOCKET
,
SO_REUSEADDR
,
&
enable
,
sizeof
(
int
)))
{
perror
(
"tcp_bridge: SO_REUSEADDR"
);
exit
(
1
);
}
struct
sockaddr_in
addr
=
{
sin_family:
AF_INET
,
sin_port:
htons
(
PORT
),
sin_addr:
{
s_addr
:
INADDR_ANY
}
sin_family:
AF_INET
,
sin_port:
htons
(
port
),
sin_addr:
{
s_addr
:
INADDR_ANY
}
};
bind
(
t
->
listen_sock
,
(
struct
sockaddr
*
)
&
addr
,
sizeof
(
addr
));
AssertFatal
(
listen
(
t
->
listen_sock
,
5
)
==
0
,
""
);
struct
epoll_event
ev
;
ev
.
events
=
EPOLLIN
;
ev
.
data
.
fd
=
t
->
listen_sock
;
AssertFatal
(
epoll_ctl
(
t
->
epollfd
,
EPOLL_CTL_ADD
,
t
->
listen_sock
,
&
ev
)
!=
-
1
,
""
);
if
(
bind
(
sock
,
(
struct
sockaddr
*
)
&
addr
,
sizeof
(
addr
)))
{
if
(
errno
==
EADDRINUSE
)
goto
client_mode
;
{
perror
(
"tcp_bridge: bind"
);
exit
(
1
);
}
}
if
(
listen
(
sock
,
5
))
{
perror
(
"tcp_bridge: listen"
);
exit
(
1
);
}
printf
(
"tcp_bridge: wait for connection on port %d
\n
"
,
port
);
socklen_t
len
=
sizeof
(
addr
);
int
sock2
=
accept
(
sock
,
(
struct
sockaddr
*
)
&
addr
,
&
len
);
if
(
sock2
==
-
1
)
{
perror
(
"tcp_bridge: accept"
);
exit
(
1
);
}
close
(
sock
);
tcp_bridge
->
sock
=
sock2
;
printf
(
"tcp_bridge: connection established
\n
"
);
verify_connection
(
sock2
,
tcp_bridge
->
is_enb
);
return
0
;
}
int
start_ue
(
openair0_device
*
device
)
{
tcp_bridge_state_t
*
t
=
init_bridge
(
device
);
t
->
typeStamp
=
MAGICUE
;
int
sock
;
AssertFatal
((
sock
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
))
>=
0
,
""
);
struct
sockaddr_in
addr
=
{
sin_family:
AF_INET
,
sin_port:
htons
(
PORT
),
sin_addr:
{
s_addr
:
INADDR_ANY
}
};
addr
.
sin_addr
.
s_addr
=
inet_addr
(
t
->
ip
);
bool
connected
=
false
;
client_mode:
addr
.
sin_addr
.
s_addr
=
inet_addr
(
"127.0.0.1"
);
while
(
!
connected
)
{
printf
(
"tcp_bridge: trying to connect to %s:%d
\n
"
,
t
->
ip
,
PORT
);
for
(
try
=
0
;
try
<
max_try
;
try
++
)
{
if
(
try
!=
0
)
sleep
(
1
);
printf
(
"tcp_bridge: trying to connect to 127.0.0.1:%d (attempt %d/%d)
\n
"
,
port
,
try
+
1
,
max_try
);
if
(
connect
(
sock
,
(
struct
sockaddr
*
)
&
addr
,
sizeof
(
addr
))
==
0
)
{
printf
(
"tcp_bridge: connection established
\n
"
);
connected
=
true
;
tcp_bridge
->
sock
=
sock
;
verify_connection
(
sock
,
tcp_bridge
->
is_enb
);
return
0
;
}
perror
(
"tcp_bridge"
);
sleep
(
1
);
}
setblocking
(
sock
,
notBlocking
);
allocCirBuf
(
t
,
sock
);
t
->
buf
[
sock
].
alreadyWrote
=
true
;
return
0
;
printf
(
"tcp_bridge: connection failed
\n
"
);
exit
(
1
);
}
int
tcp_bridge_write
(
openair0_device
*
device
,
openair0_timestamp
timestamp
,
void
**
samplesVoid
,
int
nsamps
,
int
nbAnt
,
int
flags
)
{
tcp_bridge_state_t
*
t
=
device
->
priv
;
for
(
int
i
=
0
;
i
<
FD_SETSIZE
;
i
++
)
{
buffer_t
*
ptr
=&
t
->
buf
[
i
];
if
(
ptr
->
conn_sock
>=
0
)
{
setblocking
(
ptr
->
conn_sock
,
blocking
);
transferHeader
header
=
{
t
->
typeStamp
,
nsamps
,
nbAnt
,
timestamp
};
int
n
=-
1
;
AssertFatal
(
fullwrite
(
ptr
->
conn_sock
,
&
header
,
sizeof
(
header
))
==
sizeof
(
header
),
""
);
sample_t
tmpSamples
[
nsamps
][
nbAnt
];
for
(
int
a
=
0
;
a
<
nbAnt
;
a
++
)
{
sample_t
*
in
=
(
sample_t
*
)
samplesVoid
[
a
];
for
(
int
s
=
0
;
s
<
nsamps
;
s
++
)
tmpSamples
[
s
][
a
]
=
in
[
s
];
}
n
=
fullwrite
(
ptr
->
conn_sock
,
(
void
*
)
tmpSamples
,
sampleToByte
(
nsamps
,
nbAnt
));
int
tcp_bridge_request
(
openair0_device
*
device
,
void
*
msg
,
ssize_t
msg_len
)
{
abort
();
return
0
;
}
int
tcp_bridge_reply
(
openair0_device
*
device
,
void
*
msg
,
ssize_t
msg_len
)
{
abort
();
return
0
;
}
int
tcp_bridge_get_stats
(
openair0_device
*
device
)
{
return
0
;
}
int
tcp_bridge_reset_stats
(
openair0_device
*
device
)
{
return
0
;
}
void
tcp_bridge_end
(
openair0_device
*
device
)
{}
int
tcp_bridge_stop
(
openair0_device
*
device
)
{
return
0
;
}
int
tcp_bridge_set_freq
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
,
int
exmimo_dump_config
)
{
return
0
;
}
int
tcp_bridge_set_gains
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
)
{
return
0
;
}
if
(
n
!=
sampleToByte
(
nsamps
,
nbAnt
)
)
{
printf
(
"tcp_bridge: write error ret %d (wanted %ld) error %s
\n
"
,
n
,
sampleToByte
(
nsamps
,
nbAnt
),
strerror
(
errno
));
int
tcp_bridge_write
(
openair0_device
*
device
,
openair0_timestamp
timestamp
,
void
**
buff
,
int
nsamps
,
int
cc
,
int
flags
)
{
if
(
cc
!=
1
)
{
printf
(
"tcp_bridge: only 1 antenna supported
\n
"
);
exit
(
1
);
}
tcp_bridge_state_t
*
t
=
device
->
priv
;
/* deal with discontinuities in output (think: eNB in TDD mode) */
if
(
t
->
next_tx_timestamp
&&
timestamp
!=
t
->
next_tx_timestamp
)
{
uint32_t
b
[
4096
];
uint64_t
to_send
=
timestamp
-
t
->
next_tx_timestamp
;
memset
(
b
,
0
,
4096
*
sizeof
(
uint32_t
));
while
(
to_send
)
{
int
len
=
to_send
>
4096
?
4096
:
to_send
;
int
n
=
fullwrite
(
t
->
sock
,
b
,
len
*
4
);
if
(
n
!=
len
*
4
)
{
printf
(
"tcp_bridge: write error ret %d error %s
\n
"
,
n
,
strerror
(
errno
));
abort
();
}
ptr
->
alreadyWrote
=
true
;
setblocking
(
ptr
->
conn_sock
,
notBlocking
);
to_send
-=
len
;
}
}
LOG_D
(
HW
,
"sent %d samples at time: %ld->%ld, energy in first antenna: %d
\n
"
,
nsamps
,
timestamp
,
timestamp
+
nsamps
,
signal_energy
(
samplesVoid
[
0
],
nsamps
)
);
int
n
=
fullwrite
(
t
->
sock
,
buff
[
0
],
nsamps
*
4
);
if
(
n
!=
nsamps
*
4
)
{
printf
(
"tcp_bridge: write error ret %d (wanted %d) error %s
\n
"
,
n
,
nsamps
*
4
,
strerror
(
errno
));
abort
();
}
t
->
next_tx_timestamp
=
timestamp
+
nsamps
;
return
nsamps
;
}
bool
flushInput
(
tcp_bridge_state_t
*
t
)
{
// Process all incoming events on sockets
// store the data in lists
bool
completedABuffer
=
false
;
int
iterations
=
10
;
while
(
!
completedABuffer
&&
iterations
--
)
{
struct
epoll_event
events
[
FD_SETSIZE
]
=
{
0
};
int
nfds
=
epoll_wait
(
t
->
epollfd
,
events
,
FD_SETSIZE
,
20
);
if
(
nfds
==-
1
)
{
if
(
errno
==
EINTR
||
errno
==
EAGAIN
)
continue
;
else
AssertFatal
(
false
,
"error in epoll_wait
\n
"
);
}
//printf("waited iter=%d, res %d, waiting fd %d\n", iterations, nfds, nfds>=1? events[0].data.fd:-1);
for
(
int
nbEv
=
0
;
nbEv
<
nfds
;
++
nbEv
)
{
int
fd
=
events
[
nbEv
].
data
.
fd
;
if
(
events
[
nbEv
].
events
&
EPOLLIN
&&
fd
==
t
->
listen_sock
)
{
int
conn_sock
;
AssertFatal
(
(
conn_sock
=
accept
(
t
->
listen_sock
,
NULL
,
NULL
))
!=
-
1
,
""
);
allocCirBuf
(
t
,
conn_sock
);
LOG_I
(
HW
,
"A ue connected
\n
"
);
}
else
{
if
(
events
[
nbEv
].
events
&
(
EPOLLHUP
|
EPOLLERR
|
EPOLLRDHUP
)
)
{
LOG_W
(
HW
,
"Lost socket
\n
"
);
removeCirBuf
(
t
,
fd
);
if
(
t
->
typeStamp
==
MAGICUE
)
exit
(
1
);
continue
;
}
buffer_t
*
b
=&
t
->
buf
[
fd
];
if
(
b
->
circularBuf
==
NULL
)
{
LOG_E
(
HW
,
"received data on not connected socket %d
\n
"
,
events
[
nbEv
].
data
.
fd
);
continue
;
}
int
blockSz
;
if
(
b
->
headerMode
)
blockSz
=
b
->
remainToTransfer
;
else
blockSz
=
b
->
transferPtr
+
b
->
remainToTransfer
<
b
->
circularBufEnd
?
b
->
remainToTransfer
:
b
->
circularBufEnd
-
b
->
transferPtr
;
int
sz
=
recv
(
fd
,
b
->
transferPtr
,
blockSz
,
MSG_DONTWAIT
);
if
(
sz
<
0
)
{
if
(
errno
!=
EAGAIN
)
{
LOG_E
(
HW
,
"socket failed %s
\n
"
,
strerror
(
errno
));
abort
();
}
}
else
if
(
sz
==
0
)
continue
;
AssertFatal
((
b
->
remainToTransfer
-=
sz
)
>=
0
,
""
);
b
->
transferPtr
+=
sz
;
// check the header and start block transfer
if
(
b
->
headerMode
==
true
&&
b
->
remainToTransfer
==
0
)
{
AssertFatal
(
(
t
->
typeStamp
==
MAGICUE
&&
b
->
th
.
magic
==
MAGICeNB
)
||
(
t
->
typeStamp
==
MAGICeNB
&&
b
->
th
.
magic
==
MAGICUE
),
"Socket Error in protocol"
);
b
->
headerMode
=
false
;
b
->
lastReceivedTS
=
b
->
th
.
timestamp
;
b
->
transferPtr
=
(
char
*
)
&
b
->
circularBuf
[
b
->
lastReceivedTS
%
CirSize
];
b
->
remainToTransfer
=
sampleToByte
(
b
->
th
.
size
,
b
->
th
.
nbAnt
);
}
if
(
b
->
headerMode
==
false
)
{
b
->
lastReceivedTS
=
b
->
th
.
timestamp
+
b
->
th
.
size
-
byteToSample
(
b
->
remainToTransfer
,
b
->
th
.
nbAnt
);
if
(
b
->
remainToTransfer
==
0
)
{
completedABuffer
=
true
;
LOG_D
(
HW
,
"Completed block reception: %ld
\n
"
,
b
->
lastReceivedTS
);
// First block in UE, resync with the eNB current TS
if
(
t
->
nextTimestamp
==
0
)
t
->
nextTimestamp
=
b
->
lastReceivedTS
-
b
->
th
.
size
;
b
->
headerMode
=
true
;
b
->
transferPtr
=
(
char
*
)
&
b
->
th
;
b
->
remainToTransfer
=
sizeof
(
transferHeader
);
b
->
th
.
magic
=-
1
;
}
}
}
}
int
tcp_bridge_read
(
openair0_device
*
device
,
openair0_timestamp
*
timestamp
,
void
**
buff
,
int
nsamps
,
int
cc
)
{
if
(
cc
!=
1
)
{
printf
(
"tcp_bridge: only 1 antenna supported
\n
"
);
exit
(
1
);
}
tcp_bridge_state_t
*
t
=
device
->
priv
;
int
n
=
fullread
(
t
->
sock
,
buff
[
0
],
nsamps
*
4
);
if
(
n
!=
nsamps
*
4
)
{
printf
(
"tcp_bridge: read error ret %d nsamps*4 %d error %s
\n
"
,
n
,
nsamps
*
4
,
strerror
(
errno
));
abort
();
}
return
completedABuffer
;
*
timestamp
=
t
->
timestamp
;
t
->
timestamp
+=
nsamps
;
return
nsamps
;
}
int
tcp_bridge_read
(
openair0_device
*
device
,
openair0_timestamp
*
ptimestamp
,
void
**
samplesVoid
,
int
nsamps
,
int
nbAnt
)
{
if
(
nbAnt
!=
1
)
{
printf
(
"tcp_bridge: only 1 antenna tested
\n
"
);
exit
(
1
);
}
int
tcp_bridge_read
_ue
(
openair0_device
*
device
,
openair0_timestamp
*
timestamp
,
void
**
buff
,
int
nsamps
,
int
cc
)
{
if
(
cc
!=
1
)
{
printf
(
"tcp_bridge: only 1 antenna supported
\n
"
);
exit
(
1
);
}
tcp_bridge_state_t
*
t
=
device
->
priv
;
// deliver data from received data
// check if a UE is connected
int
first_sock
;
for
(
first_sock
=
0
;
first_sock
<
FD_SETSIZE
;
first_sock
++
)
if
(
t
->
buf
[
first_sock
].
circularBuf
!=
NULL
)
break
;
if
(
first_sock
==
FD_SETSIZE
)
{
// no connected device (we are eNB, no UE is connected)
if
(
!
flushInput
(
t
))
{
for
(
int
x
=
0
;
x
<
nbAnt
;
x
++
)
memset
(
samplesVoid
[
x
],
0
,
sampleToByte
(
nsamps
,
1
));
t
->
nextTimestamp
+=
nsamps
;
LOG_W
(
HW
,
"Generated void samples for Rx: %ld
\n
"
,
t
->
nextTimestamp
);
for
(
int
a
=
0
;
a
<
nbAnt
;
a
++
)
{
sample_t
*
out
=
(
sample_t
*
)
samplesVoid
[
a
];
for
(
int
i
=
0
;
i
<
nsamps
;
i
++
)
out
[
i
]
=
0
;
}
*
ptimestamp
=
t
->
nextTimestamp
-
nsamps
;
return
nsamps
;
int
n
;
/* In synch mode, UE does not write, but we need to
* send something to the eNodeB.
* We know that UE is in synch mode when it reads
* 10 subframes at a time.
*/
if
(
nsamps
==
t
->
samples_per_subframe
*
10
)
{
uint32_t
b
[
nsamps
];
memset
(
b
,
0
,
nsamps
*
4
);
n
=
fullwrite
(
t
->
sock
,
b
,
nsamps
*
4
);
if
(
n
!=
nsamps
*
4
)
{
printf
(
"tcp_bridge: write error ret %d error %s
\n
"
,
n
,
strerror
(
errno
));
abort
();
}
}
else
{
bool
have_to_wait
;
do
{
have_to_wait
=
false
;
for
(
int
sock
=
0
;
sock
<
FD_SETSIZE
;
sock
++
)
if
(
t
->
buf
[
sock
].
circularBuf
&&
t
->
buf
[
sock
].
alreadyWrote
&&
(
t
->
nextTimestamp
+
nsamps
)
>
t
->
buf
[
sock
].
lastReceivedTS
)
{
have_to_wait
=
true
;
break
;
}
if
(
have_to_wait
)
/*printf("Waiting on socket, current last ts: %ld, expected at least : %ld\n",
ptr->lastReceivedTS,
t->nextTimestamp+nsamps);
*/
flushInput
(
t
);
}
while
(
have_to_wait
);
}
// Clear the output buffer
for
(
int
a
=
0
;
a
<
nbAnt
;
a
++
)
{
sample_t
*
out
=
(
sample_t
*
)
samplesVoid
[
a
];
for
(
int
i
=
0
;
i
<
nsamps
;
i
++
)
out
[
i
]
=
0
;
}
return
tcp_bridge_read
(
device
,
timestamp
,
buff
,
nsamps
,
cc
);
}
// Add all input signal in the output buffer
for
(
int
sock
=
0
;
sock
<
FD_SETSIZE
;
sock
++
)
{
buffer_t
*
ptr
=&
t
->
buf
[
sock
];
/* To startup proper communcation between eNB and UE,
* we need to understand that:
* - eNodeB starts reading subframe 0
* - then eNodeB starts sending subframe 4
* and then repeats read/write for each subframe.
* The UE:
* - reads 10 subframes at a time until it is synchronized
* - then reads subframe n and writes subframe n+2
* We also want to enforce that the subframe 0 is read
* at the beginning of the UE RX buffer, not in the middle
* of it.
* So it means:
* - for the eNodeB: let it run as in normal mode (as with a B210)
* - for the UE, on its very first read:
* - we want this read to get data from subframe 0
* but the first write of eNodeB is subframe 4
* so we first need to read and ignore 6 subframes
* - the UE will start its TX only at the subframe 2
* corresponding to the subframe 0 it just read,
* so we need to write 12 subframes before anything
* (the function tcp_bridge_read_ue takes care to
* insert dummy TX data during the synch phase)
*
* Here is a drawing of the beginning of things to make
* this logic clearer.
*
* We see that eNB starts RX at subframe 0, starts TX at subfram 4,
* and that UE starts RX at subframe 10 and TX at subframe 12.
*
* We understand that the UE has to transmit 12 empty
* subframes for the eNodeB to start its processing.
*
* And because the eNodeB starts its TX at subframe 4 and we
* want the UE to start its RX at subframe 10, we need to
* read and ignore 6 subframes in the UE.
*
* -------------------------------------------------------------------------
* eNB RX: | *0* | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 ...
* -------------------------------------------------------------------------
*
* -------------------------------------------------------------------------
* eNB TX: | 0 | 1 | 2 | 3 | *4* | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 ...
* -------------------------------------------------------------------------
*
* -------------------------------------------------------------------------
* UE RX: | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *10* | 11 | 12 | 13 | 14 ...
* -------------------------------------------------------------------------
*
* -------------------------------------------------------------------------
* UE TX: | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | *12* | 13 | 14 ...
* -------------------------------------------------------------------------
*
* As a final note, we do TX before RX to ensure that the eNB will
* get some data and send us something so there is no deadlock
* at the beginning of things. Hopefully the kernel buffers for
* the sockets are big enough so that the first (big) TX can
* return to user mode before the buffers are full. If this
* is wrong in some environment, we will need to work by smaller
* units of data at a time.
*/
int
tcp_bridge_ue_first_read
(
openair0_device
*
device
,
openair0_timestamp
*
timestamp
,
void
**
buff
,
int
nsamps
,
int
cc
)
{
if
(
cc
!=
1
)
{
printf
(
"tcp_bridge: only 1 antenna supported
\n
"
);
exit
(
1
);
}
tcp_bridge_state_t
*
t
=
device
->
priv
;
if
(
ptr
->
circularBuf
&&
ptr
->
alreadyWrote
)
{
for
(
int
a
=
0
;
a
<
nbAnt
;
a
++
)
{
sample_t
*
out
=
(
sample_t
*
)
samplesVoid
[
a
];
for
(
int
i
=
0
;
i
<
nsamps
;
i
++
)
out
[
i
]
+=
ptr
->
circularBuf
[(
t
->
nextTimestamp
+
(
a
*
nbAnt
+
i
))
%
CirSize
]
<<
1
;
}
}
uint32_t
b
[
t
->
samples_per_subframe
*
12
];
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
));
abort
();
}
n
=
fullread
(
t
->
sock
,
b
,
t
->
samples_per_subframe
*
6
*
4
);
if
(
n
!=
t
->
samples_per_subframe
*
6
*
4
)
{
printf
(
"tcp_bridge: read error ret %d error %s
\n
"
,
n
,
strerror
(
errno
));
abort
();
}
*
ptimestamp
=
t
->
nextTimestamp
;
// return the time of the first sample
t
->
nextTimestamp
+=
nsamps
;
LOG_D
(
HW
,
"Rx to upper layer: %d from %ld to %ld, energy in first antenna %d
\n
"
,
nsamps
,
*
ptimestamp
,
t
->
nextTimestamp
,
signal_energy
(
samplesVoid
[
0
],
nsamps
));
return
nsamps
;
}
device
->
trx_read_func
=
tcp_bridge_read_ue
;
int
tcp_bridge_request
(
openair0_device
*
device
,
void
*
msg
,
ssize_t
msg_len
)
{
abort
();
return
0
;
}
int
tcp_bridge_reply
(
openair0_device
*
device
,
void
*
msg
,
ssize_t
msg_len
)
{
abort
();
return
0
;
}
int
tcp_bridge_get_stats
(
openair0_device
*
device
)
{
return
0
;
}
int
tcp_bridge_reset_stats
(
openair0_device
*
device
)
{
return
0
;
}
void
tcp_bridge_end
(
openair0_device
*
device
)
{}
int
tcp_bridge_stop
(
openair0_device
*
device
)
{
return
0
;
}
int
tcp_bridge_set_freq
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
,
int
exmimo_dump_config
)
{
return
0
;
}
int
tcp_bridge_set_gains
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
)
{
return
0
;
return
tcp_bridge_read_ue
(
device
,
timestamp
,
buff
,
nsamps
,
cc
);
}
__attribute__
((
__visibility__
(
"default"
)))
int
device_init
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
)
{
//set_log(HW,OAILOG_DEBUG);
tcp_bridge_state_t
*
tcp_bridge
=
(
tcp_bridge_state_t
*
)
calloc
(
sizeof
(
tcp_bridge_state_t
),
1
);
int
device_init
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
)
{
tcp_bridge_state_t
*
tcp_bridge
=
(
tcp_bridge_state_t
*
)
malloc
(
sizeof
(
tcp_bridge_state_t
));
memset
(
tcp_bridge
,
0
,
sizeof
(
tcp_bridge_state_t
));
if
((
tcp_bridge
->
ip
=
getenv
(
"TCPBRIDGE"
))
==
NULL
)
{
printf
(
helpTxt
);
exit
(
1
);
}
tcp_bridge
->
is_enb
=
getenv
(
"ENODEB"
)
!=
NULL
;
tcp_bridge
->
typeStamp
=
strncasecmp
(
tcp_bridge
->
ip
,
"enb"
,
3
)
==
0
?
MAGICeNB:
MAGICUE
;
printf
(
"tcp_bridge: running as %s
\n
"
,
tcp_bridge
->
typeStamp
==
MAGICeNB
?
"eNB"
:
"UE"
);
printf
(
"tcp_bridge: running as %s
\n
"
,
tcp_bridge
->
is_enb
?
"eNB"
:
"UE"
);
/* only 25, 50 or 100 PRBs handled for the moment */
if
(
openair0_cfg
[
0
].
sample_rate
!=
30720000
&&
...
...
@@ -456,9 +305,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
exit
(
1
);
}
device
->
trx_start_func
=
tcp_bridge
->
typeStamp
==
MAGICeNB
?
server_start
:
start_ue
;
device
->
trx_start_func
=
tcp_bridge_start
;
device
->
trx_get_stats_func
=
tcp_bridge_get_stats
;
device
->
trx_reset_stats_func
=
tcp_bridge_reset_stats
;
device
->
trx_end_func
=
tcp_bridge_end
;
...
...
@@ -466,10 +313,25 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
device
->
trx_set_freq_func
=
tcp_bridge_set_freq
;
device
->
trx_set_gains_func
=
tcp_bridge_set_gains
;
device
->
trx_write_func
=
tcp_bridge_write
;
device
->
trx_read_func
=
tcp_bridge_read
;
if
(
tcp_bridge
->
is_enb
)
{
device
->
trx_read_func
=
tcp_bridge_read
;
}
else
{
device
->
trx_read_func
=
tcp_bridge_ue_first_read
;
}
device
->
priv
=
tcp_bridge
;
switch
((
int
)
openair0_cfg
[
0
].
sample_rate
)
{
case
30720000
:
tcp_bridge
->
samples_per_subframe
=
30720
;
break
;
case
15360000
:
tcp_bridge
->
samples_per_subframe
=
15360
;
break
;
case
7680000
:
tcp_bridge
->
samples_per_subframe
=
7680
;
break
;
}
/* let's pretend to be a b2x0 */
device
->
type
=
USRP_B200_DEV
;
device
->
openair0_cfg
=&
openair0_cfg
[
0
];
return
0
;
}
This diff is collapsed.
Click to expand it.
targets/COMMON/openairinterface5g_limits.h
View file @
a1347e1a
#ifndef OPENAIRINTERFACE5G_LIMITS_H_
#define OPENAIRINTERFACE5G_LIMITS_H_
#include <platform_constants.h>
#if defined(CBMIMO1) || defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_LMSSDR)
# define NUMBER_OF_eNB_MAX 1
#define NUMBER_OF_UE_MAX MAX_MOBILES_PER_ENB
#define NUMBER_OF_CONNECTED_eNB_MAX MAX_MANAGED_ENB_PER_MOBILE
#define NUMBER_OF_eNB_MAX MAX_eNB
#if defined(MANAGED_RF)
# define NUMBER_OF_RU_MAX 2
# ifndef UE_EXPANSION
# define NUMBER_OF_UE_MAX 16
# define NUMBER_OF_CONNECTED_eNB_MAX 3
# else
# define NUMBER_OF_UE_MAX 256
# define NUMBER_OF_CONNECTED_eNB_MAX 1
# endif
#else
# define NUMBER_OF_eNB_MAX 7
# define NUMBER_OF_RU_MAX 32
# ifndef UE_EXPANSION
# define NUMBER_OF_UE_MAX 20
# define NUMBER_OF_CONNECTED_eNB_MAX 3
# else
# define NUMBER_OF_UE_MAX 256
# define NUMBER_OF_CONNECTED_eNB_MAX 1
# endif
# if defined(STANDALONE) && STANDALONE==1
# undef NUMBER_OF_eNB_MAX
# undef NUMBER_OF_UE_MAX
# undef NUMBER_OF_RU_MAX
# define NUMBER_OF_eNB_MAX 3
# define NUMBER_OF_UE_MAX 3
# define NUMBER_OF_RU_MAX 3
# endif
# if defined(LARGE_SCALE) && LARGE_SCALE
# undef NUMBER_OF_eNB_MAX
# undef NUMBER_OF_UE_MAX
# undef NUMBER_OF_CONNECTED_eNB_MAX
# undef NUMBER_OF_RU_MAX
# define NUMBER_OF_eNB_MAX 2
# define NUMBER_OF_UE_MAX 120
# define NUMBER_OF_RU_MAX 16
# define NUMBER_OF_CONNECTED_eNB_MAX 1 // to save some memory
# endif
#endif
...
...
This diff is collapsed.
Click to expand it.
targets/TEST/PDCP/with_rlc/test_pdcp_rlc.c
View file @
a1347e1a
...
...
@@ -224,7 +224,6 @@ int main(int argc, char **argv)
char
*
g_log_level
=
"trace"
;
// by default global log level is set to trace
mac_xface
=
malloc
(
sizeof
(
MAC_xface
));
Mac_rlc_xface
=
(
MAC_RLC_XFACE
*
)
malloc16
(
sizeof
(
MAC_RLC_XFACE
));
rlc_module_init
();
pdcp_module_init
();
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment