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
canghaiwuhen
OpenXG-RAN
Commits
217491cb
Commit
217491cb
authored
Jul 01, 2019
by
laurent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
progress in main cleanup coding
parent
8493071b
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
442 additions
and
321 deletions
+442
-321
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+5
-5
executables/main-ocp.c
executables/main-ocp.c
+267
-261
executables/split_headers.h
executables/split_headers.h
+3
-2
targets/ARCH/rfsimulator/simulator.c
targets/ARCH/rfsimulator/simulator.c
+40
-22
targets/RT/USER/lte-softmodem.c
targets/RT/USER/lte-softmodem.c
+127
-31
No files found.
cmake_targets/CMakeLists.txt
View file @
217491cb
...
...
@@ -2090,9 +2090,9 @@ target_link_libraries (lte-softmodem
-Wl,--end-group z dl
)
add_executable
(
simple
-softmodem
add_executable
(
ocp
-softmodem
${
OPENAIR_TARGETS
}
/RT/USER/rt_wrapper.c
${
OPENAIR_DIR
}
/executables/
simple_main
.c
${
OPENAIR_DIR
}
/executables/
main-ocp
.c
${
OPENAIR_TARGETS
}
/RT/USER/lte-softmodem.c
${
OPENAIR_TARGETS
}
/RT/USER/lte-softmodem-common.c
${
OPENAIR2_DIR
}
/ENB_APP/NB_IoT_interface.c
...
...
@@ -2113,15 +2113,15 @@ add_executable(simple-softmodem
${
CONFIG_SOURCES
}
${
SHLIB_LOADER_SOURCES
}
)
add_dependencies
(
simple
-softmodem rrc_flag s1ap_flag x2_flag
)
add_dependencies
(
ocp
-softmodem rrc_flag s1ap_flag x2_flag
)
target_link_libraries
(
simple
-softmodem
target_link_libraries
(
ocp
-softmodem
-Wl,--start-group
RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP X2AP_LIB X2AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2
${
MSC_LIB
}
${
RAL_LIB
}
${
NAS_UE_LIB
}
${
ITTI_LIB
}
${
FLPT_MSG_LIB
}
${
ASYNC_IF_LIB
}
${
FLEXRAN_AGENT_LIB
}
${
FSPT_MSG_LIB
}
${
PROTO_AGENT_LIB
}
LFDS7
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
-Wl,--end-group z dl
)
target_link_libraries
(
simple
-softmodem
${
LIBXML2_LIBRARIES
}
pthread m
${
CONFIG_LIBRARIES
}
rt crypt
${
CRYPTO_LIBRARIES
}
${
OPENSSL_LIBRARIES
}
${
NETTLE_LIBRARIES
}
sctp
${
PROTOBUF_LIB
}
${
CMAKE_DL_LIBS
}
${
LIBYAML_LIBRARIES
}
${
LIB_LMS_LIBRARIES
}
${
T_LIB
}
)
target_link_libraries
(
ocp
-softmodem
${
LIBXML2_LIBRARIES
}
pthread m
${
CONFIG_LIBRARIES
}
rt crypt
${
CRYPTO_LIBRARIES
}
${
OPENSSL_LIBRARIES
}
${
NETTLE_LIBRARIES
}
sctp
${
PROTOBUF_LIB
}
${
CMAKE_DL_LIBS
}
${
LIBYAML_LIBRARIES
}
${
LIB_LMS_LIBRARIES
}
${
T_LIB
}
)
add_executable
(
cu_test
${
OPENAIR2_DIR
}
/LAYER2/PROTO_AGENT/cu_test.c
...
...
executables/
simple_main
.c
→
executables/
main-ocp
.c
View file @
217491cb
This diff is collapsed.
Click to expand it.
executables/split_headers.h
View file @
217491cb
...
...
@@ -23,6 +23,7 @@ typedef struct frequency_s {
}
frequency_t
;
int
createListner
(
port
);
int
receiveSubFrame
(
int
sock
,
uint64_t
expectedTS
,
void
*
bufferZone
,
int
bufferSize
);
int
sendSubFrame
(
int
sock
,
void
*
bufferZone
,
int
nbBlocks
);
}
int
receiveSubFrame
(
int
sock
,
uint64_t
expectedTS
,
void
*
bufferZone
,
int
bufferSize
);
int
sendSubFrame
(
int
sock
,
void
*
bufferZone
,
int
nbBlocks
);
}
#endif
targets/ARCH/rfsimulator/simulator.c
View file @
217491cb
...
...
@@ -47,8 +47,8 @@ pthread_mutex_t Sockmutex;
typedef
struct
buffer_s
{
int
conn_sock
;
bool
alreadyRead
;
uint64_t
lastReceived
TS
;
openair0_timestamp
lastReceivedTS
;
openair0_timestamp
lastWrote
TS
;
bool
headerMode
;
samplesBlockHeader_t
th
;
char
*
transferPtr
;
...
...
@@ -60,7 +60,7 @@ typedef struct buffer_s {
typedef
struct
{
int
listen_sock
,
epollfd
;
uint64_t
nextTimestamp
;
openair0_timestamp
nextTimestamp
;
uint64_t
typeStamp
;
char
*
ip
;
int
saveIQfile
;
...
...
@@ -153,8 +153,8 @@ void allocCirBuf(rfsimulator_state_t *bridge, int sock) {
AssertFatal
(
(
ptr
->
circularBuf
=
(
sample_t
*
)
malloc
(
sampleToByte
(
CirSize
,
1
)))
!=
NULL
,
""
);
ptr
->
circularBufEnd
=
((
char
*
)
ptr
->
circularBuf
)
+
sampleToByte
(
CirSize
,
1
);
ptr
->
conn_sock
=
sock
;
ptr
->
alreadyRead
=
false
;
ptr
->
lastReceivedTS
=
0
;
ptr
->
lastWroteTS
=
0
;
ptr
->
headerMode
=
true
;
ptr
->
transferPtr
=
(
char
*
)
&
ptr
->
th
;
ptr
->
remainToTransfer
=
sizeof
(
samplesBlockHeader_t
);
...
...
@@ -319,21 +319,22 @@ sin_addr:
setblocking
(
sock
,
notBlocking
);
allocCirBuf
(
t
,
sock
);
t
->
buf
[
sock
].
alreadyRead
=
true
;
// UE will start blocking on read
return
0
;
}
uint64_t
lastW
=-
1
;
int
rfsimulator_write
(
openair0_device
*
device
,
openair0_timestamp
timestamp
,
void
**
samplesVoid
,
int
nsamps
,
int
nbAnt
,
int
flags
)
{
rfsimulator_state_t
*
t
=
device
->
priv
;
LOG_D
(
HW
,
"sending %d samples at time: %ld
\n
"
,
nsamps
,
timestamp
);
for
(
int
i
=
0
;
i
<
FD_SETSIZE
;
i
++
)
{
buffer_t
*
ptr
=&
t
->
buf
[
i
];
buffer_t
*
b
=&
t
->
buf
[
i
];
if
(
ptr
->
conn_sock
>=
0
)
{
if
(
b
->
conn_sock
>=
0
)
{
if
(
abs
((
double
)
b
->
lastWroteTS
-
timestamp
)
>
(
double
)
CirSize
)
LOG_E
(
HW
,
"Tx/Rx shift too large Tx:%lu, Rx:%lu
\n
"
,
b
->
lastWroteTS
,
b
->
lastReceivedTS
);
samplesBlockHeader_t
header
=
{
t
->
typeStamp
,
nsamps
,
nbAnt
,
timestamp
};
fullwrite
(
ptr
->
conn_sock
,
&
header
,
sizeof
(
header
),
t
);
fullwrite
(
b
->
conn_sock
,
&
header
,
sizeof
(
header
),
t
);
sample_t
tmpSamples
[
nsamps
][
nbAnt
];
for
(
int
a
=
0
;
a
<
nbAnt
;
a
++
)
{
...
...
@@ -343,17 +344,17 @@ int rfsimulator_write(openair0_device *device, openair0_timestamp timestamp, voi
tmpSamples
[
s
][
a
]
=
in
[
s
];
}
if
(
ptr
->
conn_sock
>=
0
)
fullwrite
(
ptr
->
conn_sock
,
(
void
*
)
tmpSamples
,
sampleToByte
(
nsamps
,
nbAnt
),
t
);
if
(
b
->
conn_sock
>=
0
)
{
fullwrite
(
b
->
conn_sock
,
(
void
*
)
tmpSamples
,
sampleToByte
(
nsamps
,
nbAnt
),
t
);
b
->
lastWroteTS
=
timestamp
+
nsamps
;
}
}
}
lastW
=
timestamp
;
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
)
);
// Let's verify we don't have incoming data
// This is mandatory when the opposite side don't transmit
// This is mandatory when the opposite side don't transmit
flushInput
(
t
,
0
);
pthread_mutex_unlock
(
&
Sockmutex
);
return
nsamps
;
...
...
@@ -425,7 +426,6 @@ static bool flushInput(rfsimulator_state_t *t, int timeout) {
AssertFatal
(
(
t
->
typeStamp
==
UE_MAGICDL_FDD
&&
b
->
th
.
magic
==
ENB_MAGICDL_FDD
)
||
(
t
->
typeStamp
==
ENB_MAGICDL_FDD
&&
b
->
th
.
magic
==
UE_MAGICDL_FDD
),
"Socket Error in protocol"
);
b
->
headerMode
=
false
;
b
->
alreadyRead
=
true
;
if
(
b
->
lastReceivedTS
!=
b
->
th
.
timestamp
)
{
int
nbAnt
=
b
->
th
.
nbAnt
;
...
...
@@ -441,8 +441,8 @@ static bool flushInput(rfsimulator_state_t *t, int timeout) {
}
b
->
lastReceivedTS
=
b
->
th
.
timestamp
;
AssertFatal
(
lastW
==
-
1
||
(
abs
((
double
)
lastW
-
b
->
lastReceivedTS
)
<
(
double
)
CirSize
),
"Tx/Rx shift too large Tx:%lu, Rx:%lu
\n
"
,
lastW
,
b
->
lastReceivedTS
);
AssertFatal
(
b
->
lastWroteTS
==
0
||
(
abs
((
double
)
b
->
lastWroteTS
-
b
->
lastReceivedTS
)
<
(
double
)
CirSize
),
"Tx/Rx shift too large Tx:%lu, Rx:%lu
\n
"
,
b
->
lastWroteTS
,
b
->
lastReceivedTS
);
b
->
transferPtr
=
(
char
*
)
&
b
->
circularBuf
[
b
->
lastReceivedTS
%
CirSize
];
b
->
remainToTransfer
=
sampleToByte
(
b
->
th
.
size
,
b
->
th
.
nbAnt
);
}
...
...
@@ -498,15 +498,33 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo
return
nsamps
;
}
}
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
].
alreadyRead
)
if
(
t
->
buf
[
sock
].
lastReceivedTS
==
0
||
(
t
->
nextTimestamp
+
nsamps
)
>
t
->
buf
[
sock
].
lastReceivedTS
)
{
buffer_t
*
b
=&
t
->
buf
[
sock
];
if
(
b
->
circularBuf
)
{
LOG_D
(
HW
,
"sock: %d, lastWroteTS: %lu, lastRecvTS: %lu, TS must be avail: %lu
\n
"
,
sock
,
b
->
lastWroteTS
,
b
->
lastReceivedTS
,
t
->
nextTimestamp
+
nsamps
);
if
(
b
->
lastReceivedTS
>
b
->
lastWroteTS
)
{
// The caller momdem (NB, UE, ...) must send Tx in advance, so we fill TX if Rx is in advance
// This occurs for example when UE is in sync mode: it doesn't transmit
// with USRP, it seems ok: if "tx stream" is off, we may consider it actually cuts the Tx power
struct
complex16
v
=
{
0
};
void
*
samplesVoid
[
b
->
th
.
nbAnt
];
for
(
int
i
=
0
;
i
<
b
->
th
.
nbAnt
;
i
++
)
samplesVoid
[
i
]
=
(
void
*
)
&
v
;
rfsimulator_write
(
device
,
b
->
lastReceivedTS
,
samplesVoid
,
1
,
b
->
th
.
nbAnt
,
0
);
}
}
if
(
b
->
circularBuf
)
if
(
t
->
nextTimestamp
+
nsamps
>
b
->
lastReceivedTS
)
{
have_to_wait
=
true
;
break
;
}
...
...
@@ -529,7 +547,7 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo
for
(
int
sock
=
0
;
sock
<
FD_SETSIZE
;
sock
++
)
{
buffer_t
*
ptr
=&
t
->
buf
[
sock
];
if
(
ptr
->
circularBuf
&&
ptr
->
alreadyRead
)
{
if
(
ptr
->
circularBuf
)
{
bool
reGenerateChannel
=
false
;
//fixme: when do we regenerate
...
...
targets/RT/USER/lte-softmodem.c
View file @
217491cb
...
...
@@ -80,7 +80,7 @@ unsigned short config_frames[4] = {2,9,11,13};
//#include "PHY/TOOLS/time_meas.h"
#ifndef OPENAIR2
#include "UTIL/OTG/otg_vars.h"
#include "UTIL/OTG/otg_vars.h"
#endif
...
...
@@ -91,6 +91,7 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "system.h"
#include "lte-softmodem.h"
#include "NB_IoT_interface.h"
...
...
@@ -107,6 +108,10 @@ pthread_mutex_t sync_mutex;
int
sync_var
=-
1
;
//!< protected by mutex \ref sync_mutex.
int
config_sync_var
=-
1
;
uint16_t
runtime_phy_rx
[
29
][
6
];
// SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75, 100]
uint16_t
runtime_phy_tx
[
29
][
6
];
// SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75, 100]
volatile
int
oai_exit
=
0
;
uint32_t
downlink_frequency
[
MAX_NUM_CCs
][
4
];
...
...
@@ -145,10 +150,18 @@ char ref[128] = "internal";
char
channels
[
128
]
=
"0"
;
int
rx_input_level_dBm
;
int
otg_enabled
;
uint8_t
exit_missed_slots
=
1
;
uint64_t
num_missed_slots
=
0
;
// counter for the number of missed slots
extern
void
reset_opp_meas
(
void
);
extern
void
print_opp_meas
(
void
);
extern
void
init_eNB_afterRU
(
void
);
extern
void
phy_free_RU
(
RU_t
*
);
...
...
@@ -159,11 +172,73 @@ int numerology = 0;
THREAD_STRUCT
thread_struct
;
/* struct for ethernet specific parameters given in eNB conf file */
eth_params_t
*
eth_params
;
double
cpuf
;
/* forward declarations */
/* forward declarations */
void
set_default_frame_parms
(
LTE_DL_FRAME_PARMS
*
frame_parms
[
MAX_NUM_CCs
]);
/*---------------------BMC: timespec helpers -----------------------------*/
struct
timespec
min_diff_time
=
{
.
tv_sec
=
0
,
.
tv_nsec
=
0
};
struct
timespec
max_diff_time
=
{
.
tv_sec
=
0
,
.
tv_nsec
=
0
};
struct
timespec
clock_difftime
(
struct
timespec
start
,
struct
timespec
end
)
{
struct
timespec
temp
;
if
((
end
.
tv_nsec
-
start
.
tv_nsec
)
<
0
)
{
temp
.
tv_sec
=
end
.
tv_sec
-
start
.
tv_sec
-
1
;
temp
.
tv_nsec
=
1000000000
+
end
.
tv_nsec
-
start
.
tv_nsec
;
}
else
{
temp
.
tv_sec
=
end
.
tv_sec
-
start
.
tv_sec
;
temp
.
tv_nsec
=
end
.
tv_nsec
-
start
.
tv_nsec
;
}
return
temp
;
}
void
print_difftimes
(
void
)
{
#ifdef DEBUG
printf
(
"difftimes min = %lu ns ; max = %lu ns
\n
"
,
min_diff_time
.
tv_nsec
,
max_diff_time
.
tv_nsec
);
#else
LOG_I
(
HW
,
"difftimes min = %lu ns ; max = %lu ns
\n
"
,
min_diff_time
.
tv_nsec
,
max_diff_time
.
tv_nsec
);
#endif
}
void
update_difftimes
(
struct
timespec
start
,
struct
timespec
end
)
{
struct
timespec
diff_time
=
{
.
tv_sec
=
0
,
.
tv_nsec
=
0
};
int
changed
=
0
;
diff_time
=
clock_difftime
(
start
,
end
);
if
((
min_diff_time
.
tv_nsec
==
0
)
||
(
diff_time
.
tv_nsec
<
min_diff_time
.
tv_nsec
))
{
min_diff_time
.
tv_nsec
=
diff_time
.
tv_nsec
;
changed
=
1
;
}
if
((
max_diff_time
.
tv_nsec
==
0
)
||
(
diff_time
.
tv_nsec
>
max_diff_time
.
tv_nsec
))
{
max_diff_time
.
tv_nsec
=
diff_time
.
tv_nsec
;
changed
=
1
;
}
#if 1
if
(
changed
)
print_difftimes
();
#endif
}
/*------------------------------------------------------------------------*/
unsigned
int
build_rflocal
(
int
txi
,
int
txq
,
int
rxi
,
int
rxq
)
{
return
(
txi
+
(
txq
<<
6
)
+
(
rxi
<<
12
)
+
(
rxq
<<
18
));
}
unsigned
int
build_rfdc
(
int
dcoff_i_rxfe
,
int
dcoff_q_rxfe
)
{
return
(
dcoff_i_rxfe
+
(
dcoff_q_rxfe
<<
8
));
}
void
signal_handler
(
int
sig
)
{
void
*
array
[
10
];
size_t
size
;
...
...
@@ -181,6 +256,7 @@ void signal_handler(int sig) {
}
}
void
exit_function
(
const
char
*
file
,
const
char
*
function
,
const
int
line
,
const
char
*
s
)
{
int
ru_id
;
...
...
@@ -209,6 +285,7 @@ void exit_function(const char *file, const char *function, const int line, const
exit
(
1
);
}
static
void
get_options
(
void
)
{
CONFIG_SETRTFLAG
(
CONFIG_NOEXITONHELP
);
get_common_options
();
...
...
@@ -232,6 +309,10 @@ static void get_options(void) {
}
}
void
set_default_frame_parms
(
LTE_DL_FRAME_PARMS
*
frame_parms
[
MAX_NUM_CCs
])
{
int
CC_id
;
...
...
@@ -446,11 +527,14 @@ int main( int argc, char **argv ) {
int
CC_id
=
0
;
int
ru_id
;
AssertFatal
(
load_configmodule
(
argc
,
argv
,
0
)
!=
NULL
,
"[SOFTMODEM] Error, configuration module init failed
\n
"
);
if
(
load_configmodule
(
argc
,
argv
,
0
)
==
NULL
)
{
exit_fun
(
"[SOFTMODEM] Error, configuration module init failed
\n
"
);
}
mode
=
normal_txrx
;
logInit
();
printf
(
"Reading in command-line options
\n
"
);
get_options
();
AssertFatal
(
!
CONFIG_ISFLAGSET
(
CONFIG_ABORT
),
"Getting configuration failed
\n
"
);
...
...
@@ -472,14 +556,21 @@ int main( int argc, char **argv ) {
EPC_MODE_ENABLED
=
!
IS_SOFTMODEM_NOS1
;
if
(
CONFIG_ISFLAGSET
(
CONFIG_ABORT
)
)
{
fprintf
(
stderr
,
"Getting configuration failed
\n
"
);
exit
(
-
1
);
}
#if T_TRACER
T_Config_Init
();
#endif
//randominit (0);
set_taus_seed
(
0
);
printf
(
"configuring for RAU/RRU
\n
"
);
if
(
opp_enabled
==
1
)
if
(
opp_enabled
==
1
)
{
reset_opp_meas
();
}
itti_init
(
TASK_MAX
,
THREAD_MAX
,
MESSAGES_ID_MAX
,
tasks_info
,
messages_info
);
// allows to forward in wireshark L2 protocol for decoding
...
...
@@ -491,8 +582,9 @@ int main( int argc, char **argv ) {
/* Start the agent. If it is turned off in the configuration, it won't start */
RCconfig_flexran
();
for
(
i
=
0
;
i
<
RC
.
nb_inst
;
i
++
)
for
(
i
=
0
;
i
<
RC
.
nb_inst
;
i
++
)
{
flexran_agent_start
(
i
);
}
/* initializes PDCP and sets correct RLC Request/PDCP Indication callbacks
* for monolithic/F1 modes */
...
...
@@ -556,9 +648,11 @@ int main( int argc, char **argv ) {
// for (inst=0;inst<RC.nb_L1_inst;inst++)
// for (CC_id=0;CC_id<RC.nb_L1_CC[inst];CC_id++) phy_init_lte_eNB(RC.eNB[inst][CC_id],0,0);
}
printf
(
"wait_eNBs()
\n
"
);
wait_eNBs
();
printf
(
"About to Init RU threads RC.nb_RU:%d
\n
"
,
RC
.
nb_RU
);
// no need to wait: openair_rrc_eNB_configuration() is called earlier from this thread
// openair_rrc_eNB_configuration()->init_SI()->rrc_mac_config_req_eNB ()->phy_config_request () sets the wait_eNBs() tested flag
// wait_eNBs();
// printf("About to Init RU threads RC.nb_RU:%d\n", RC.nb_RU);
// RU thread and some L1 procedure aren't necessary in VNF or L2 FAPI simulator.
// but RU thread deals with pre_scd and this is necessary in VNF and simulator.
...
...
@@ -571,6 +665,7 @@ int main( int argc, char **argv ) {
RC
.
ru
[
ru_id
]
->
rf_map
.
card
=
0
;
RC
.
ru
[
ru_id
]
->
rf_map
.
chain
=
CC_id
+
(
get_softmodem_params
()
->
chain_offset
);
}
}
config_sync_var
=
0
;
...
...
@@ -604,6 +699,7 @@ int main( int argc, char **argv ) {
pthread_mutex_unlock
(
&
sync_mutex
);
config_check_unknown_cmdlineopt
(
CONFIG_CHECKALLSECTIONS
);
}
// wait for end of program
LOG_UI
(
ENB_APP
,
"TYPE <CTRL-C> TO TERMINATE
\n
"
);
// CI -- Flushing the std outputs for the previous marker to show on the eNB / DU / CU log file
...
...
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