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
spbro
OpenXG-RAN
Commits
b1a4d4ea
Commit
b1a4d4ea
authored
Nov 05, 2018
by
Wang Tsu-Han
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding parallel structure
parent
818b27c1
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
404 additions
and
60 deletions
+404
-60
openair1/PHY/defs_RU.h
openair1/PHY/defs_RU.h
+0
-2
openair2/GNB_APP/gnb_config.c
openair2/GNB_APP/gnb_config.c
+35
-1
openair2/GNB_APP/gnb_paramdef.h
openair2/GNB_APP/gnb_paramdef.h
+26
-0
targets/RT/USER/nr-gnb.c
targets/RT/USER/nr-gnb.c
+160
-14
targets/RT/USER/nr-ru.c
targets/RT/USER/nr-ru.c
+183
-43
No files found.
openair1/PHY/defs_RU.h
View file @
b1a4d4ea
...
...
@@ -304,8 +304,6 @@ typedef struct RU_proc_t_s {
int
instance_pre_scd
;
#endif
/// pipeline ready state
int
ru_rx_ready
;
int
ru_tx_ready
;
int
emulate_rf_busy
;
}
RU_proc_t
;
...
...
openair2/GNB_APP/gnb_config.c
View file @
b1a4d4ea
...
...
@@ -77,6 +77,10 @@
#include "NR_EUTRA-MBSFN-SubframeConfig.h"
extern
uint16_t
sf_ahead
;
extern
void
set_parallel_conf
(
char
*
parallel_conf
);
extern
void
set_worker_conf
(
char
*
worker_conf
);
extern
PARALLEL_CONF_t
get_thread_parallel_conf
(
void
);
extern
WORKER_CONF_t
get_thread_worker_conf
(
void
);
void
RCconfig_nr_flexran
()
{
...
...
@@ -2976,6 +2980,36 @@ int RCconfig_NR_S1(MessageDef *msg_p, uint32_t i) {
return
0
;
}
int
RCconfig_nr_parallel
(
void
)
{
char
*
parallel_conf
=
NULL
;
char
*
worker_conf
=
NULL
;
extern
char
*
parallel_config
;
extern
char
*
worker_config
;
paramdef_t
ThreadParams
[]
=
THREAD_CONF_DESC
;
paramlist_def_t
THREADParamList
=
{
THREAD_CONFIG_STRING_THREAD_STRUCT
,
NULL
,
0
};
config_getlist
(
&
THREADParamList
,
NULL
,
0
,
NULL
);
if
(
THREADParamList
.
numelt
>
0
)
{
config_getlist
(
&
THREADParamList
,
ThreadParams
,
sizeof
(
ThreadParams
)
/
sizeof
(
paramdef_t
),
NULL
);
parallel_conf
=
strdup
(
*
(
THREADParamList
.
paramarray
[
0
][
THREAD_PARALLEL_IDX
].
strptr
));
}
else
{
parallel_conf
=
strdup
(
"PARALLEL_RU_L1_TRX_SPLIT"
);
}
if
(
THREADParamList
.
numelt
>
0
)
{
config_getlist
(
&
THREADParamList
,
ThreadParams
,
sizeof
(
ThreadParams
)
/
sizeof
(
paramdef_t
),
NULL
);
worker_conf
=
strdup
(
*
(
THREADParamList
.
paramarray
[
0
][
THREAD_WORKER_IDX
].
strptr
));
}
else
{
worker_conf
=
strdup
(
"WORKER_ENABLE"
);
}
if
(
parallel_config
==
NULL
)
set_parallel_conf
(
parallel_conf
);
if
(
worker_config
==
NULL
)
set_worker_conf
(
worker_conf
);
return
0
;
}
void
NRRCConfig
(
void
)
{
paramlist_def_t
MACRLCParamList
=
{
CONFIG_STRING_MACRLC_LIST
,
NULL
,
0
};
...
...
@@ -3016,7 +3050,7 @@ void NRRCConfig(void) {
config_getlist
(
&
RUParamList
,
NULL
,
0
,
NULL
);
RC
.
nb_RU
=
RUParamList
.
numelt
;
RCconfig_parallel
();
RCconfig_
nr_
parallel
();
}
openair2/GNB_APP/gnb_paramdef.h
View file @
b1a4d4ea
...
...
@@ -1099,3 +1099,29 @@ typedef enum {
#define MACRLC_REMOTE_S_PORTD_IDX 16
#define MACRLC_SCHED_MODE_IDX 17
#define MACRLC_PHY_TEST_IDX 18
/* thread configuration parameters section name */
#define THREAD_CONFIG_STRING_THREAD_STRUCT "THREAD_STRUCT"
/* thread configuration parameters names */
#define THREAD_CONFIG_STRING_PARALLEL "parallel_config"
#define THREAD_CONFIG_STRING_WORKER "worker_config"
#define THREAD_PARALLEL_IDX 0
#define THREAD_WORKER_IDX 1
/*-------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* thread configuration parameters */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*-------------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define THREAD_CONF_DESC { \
{THREAD_CONFIG_STRING_PARALLEL, CONFIG_HLP_PARALLEL, 0, strptr:NULL, defstrval:"PARALLEL_RU_L1_TRX_SPLIT", TYPE_STRING, 0}, \
{THREAD_CONFIG_STRING_WORKER, CONFIG_HLP_WORKER, 0, strptr:NULL, defstrval:"WORKER_ENABLE", TYPE_STRING, 0} \
}
#define CONFIG_HLP_WORKER "coding and FEP worker thread WORKER_DISABLE or WORKER_ENABLE\n"
#define CONFIG_HLP_PARALLEL "PARALLEL_SINGLE_THREAD, PARALLEL_RU_L1_SPLIT, or PARALLEL_RU_L1_TRX_SPLIT(RU_L1_TRX_SPLIT by defult)\n"
/*-------------------------------------------------------------------------------------------------------------------------------------------------------------*/
targets/RT/USER/nr-gnb.c
View file @
b1a4d4ea
...
...
@@ -143,6 +143,11 @@ extern double cpuf;
void
init_gNB
(
int
,
int
);
void
stop_gNB
(
int
nb_inst
);
int
wakeup_txfh
(
gNB_L1_rxtx_proc_t
*
proc
,
PHY_VARS_gNB
*
gNB
);
int
wakeup_tx
(
PHY_VARS_gNB
*
gNB
);
extern
PARALLEL_CONF_t
get_thread_parallel_conf
(
void
);
extern
WORKER_CONF_t
get_thread_worker_conf
(
void
);
void
wakeup_prach_gNB
(
PHY_VARS_gNB
*
gNB
,
RU_t
*
ru
,
int
frame
,
int
subframe
);
...
...
@@ -227,7 +232,9 @@ static inline int rxtx(PHY_VARS_gNB *gNB,gNB_L1_rxtx_proc_t *proc, char *thread_
//if (wait_CCs(proc)<0) return(-1);
if
(
oai_exit
)
return
(
-
1
);
phy_procedures_gNB_TX
(
gNB
,
proc
,
1
);
if
(
get_thread_parallel_conf
()
==
PARALLEL_SINGLE_THREAD
){
phy_procedures_gNB_TX
(
gNB
,
proc
,
1
);
}
stop_meas
(
&
softmodem_stats_rxtx_sf
);
...
...
@@ -278,6 +285,44 @@ static inline int rxtx(PHY_VARS_gNB *gNB,gNB_L1_rxtx_proc_t *proc, char *thread_
return
(
0
);
}
static
void
*
gNB_L1_thread_tx
(
void
*
param
)
{
gNB_L1_proc_t
*
gNB_proc
=
(
gNB_L1_proc_t
*
)
param
;
gNB_L1_rxtx_proc_t
*
proc
=
&
gNB_proc
->
L1_proc_tx
;
PHY_VARS_gNB
*
gNB
=
RC
.
gNB
[
0
][
proc
->
CC_id
];
char
thread_name
[
100
];
sprintf
(
thread_name
,
"TXnp4_%d
\n
"
,
&
gNB
->
proc
.
L1_proc
==
proc
?
0
:
1
);
thread_top_init
(
thread_name
,
1
,
470000
,
500000
,
500000
);
//wait_sync("tx_thread");
while
(
!
oai_exit
)
{
if
(
wait_on_condition
(
&
proc
->
mutex
,
&
proc
->
cond
,
&
proc
->
instance_cnt
,
thread_name
)
<
0
)
break
;
if
(
oai_exit
)
break
;
// *****************************************
// TX processing for subframe n+4
// run PHY TX procedures the one after the other for all CCs to avoid race conditions
// (may be relaxed in the future for performance reasons)
// *****************************************
phy_procedures_gNB_TX
(
gNB
,
proc
,
1
);
pthread_mutex_lock
(
&
proc
->
mutex
);
proc
->
instance_cnt
=
-
1
;
// the thread can now be woken up
if
(
pthread_cond_signal
(
&
proc
->
cond
)
!=
0
)
{
LOG_E
(
PHY
,
"[gNB] ERROR pthread_cond_signal for gNB TXnp4 thread
\n
"
);
exit_fun
(
"ERROR pthread_cond_signal"
);
}
pthread_mutex_unlock
(
&
proc
->
mutex
);
wakeup_txfh
(
proc
,
gNB
);
}
return
0
;
}
/*!
* \brief The RX UE-specific and TX thread of gNB.
...
...
@@ -285,11 +330,11 @@ static inline int rxtx(PHY_VARS_gNB *gNB,gNB_L1_rxtx_proc_t *proc, char *thread_
* \returns a pointer to an int. The storage is not on the heap and must not be freed.
*/
static
void
*
gNB_
thread_rxtx
(
void
*
param
)
{
static
void
*
gNB_
L1_thread
(
void
*
param
)
{
static
int
gNB_thread_rxtx_status
;
gNB_L1_rxtx_proc_t
*
proc
=
(
gNB_L1_rxtx_proc_t
*
)
param
;
gNB_L1_proc_t
*
gNB_proc
=
(
gNB_L1_proc_t
*
)
param
;
gNB_L1_rxtx_proc_t
*
proc
=
&
gNB_proc
->
L1_proc
;
PHY_VARS_gNB
*
gNB
=
RC
.
gNB
[
0
][
proc
->
CC_id
];
char
thread_name
[
100
];
...
...
@@ -303,11 +348,9 @@ static void* gNB_thread_rxtx( void* param ) {
thread_top_init
(
thread_name
,
1
,
850000L
,
1000000L
,
2000000L
);
while
(
!
oai_exit
)
{
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0
+
(
proc
->
subframe_rx
&
1
),
0
);
if
(
wait_on_condition
(
&
proc
->
mutex
,
&
proc
->
cond
,
&
proc
->
instance_cnt
,
thread_name
)
<
0
)
break
;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0
+
(
proc
->
subframe_rx
&
1
),
1
);
if
(
oai_exit
)
break
;
...
...
@@ -316,12 +359,19 @@ static void* gNB_thread_rxtx( void* param ) {
if
(
rxtx
(
gNB
,
proc
,
thread_name
)
<
0
)
break
;
}
if
(
get_thread_parallel_conf
()
==
PARALLEL_RU_L1_SPLIT
){
phy_procedures_gNB_TX
(
gNB
,
proc
,
1
);
}
if
(
release_thread
(
&
proc
->
mutex
,
&
proc
->
instance_cnt
,
thread_name
)
<
0
)
break
;
if
(
get_thread_parallel_conf
()
==
PARALLEL_RU_L1_TRX_SPLIT
){
wakeup_tx
(
gNB
);
}
else
if
(
get_thread_parallel_conf
()
==
PARALLEL_RU_L1_SPLIT
){
wakeup_txfh
(
proc
,
gNB
);
}
}
// while !oai_exit
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0
+
(
proc
->
subframe_rx
&
1
),
0
);
LOG_D
(
PHY
,
" *** Exiting gNB thread RXn_TXnp4
\n
"
);
...
...
@@ -379,6 +429,101 @@ void gNB_top(PHY_VARS_gNB *gNB, int frame_rx, int subframe_rx, char *string, str
}
}
int
wakeup_txfh
(
gNB_L1_rxtx_proc_t
*
proc
,
PHY_VARS_gNB
*
gNB
)
{
RU_t
*
ru
;
RU_proc_t
*
ru_proc
;
struct
timespec
wait
;
wait
.
tv_sec
=
0
;
wait
.
tv_nsec
=
5000000L
;
//printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~inside wakeup_txfh %d.%d IC_RU = %d\n", proc->frame_tx, proc->subframe_tx, proc->instance_cnt_RUs);
if
(
wait_on_condition
(
&
proc
->
mutex_RUs
,
&
proc
->
cond_RUs
,
&
proc
->
instance_cnt_RUs
,
"wakeup_txfh"
)
<
0
)
{
LOG_E
(
PHY
,
"Frame %d, subframe %d: TX FH not ready
\n
"
,
proc
->
frame_tx
,
proc
->
subframe_tx
);
return
(
-
1
);
}
pthread_mutex_lock
(
&
gNB
->
proc
.
mutex_RU_tx
);
gNB
->
proc
.
RU_mask_tx
=
0
;
pthread_mutex_unlock
(
&
gNB
->
proc
.
mutex_RU_tx
);
if
(
release_thread
(
&
proc
->
mutex_RUs
,
&
proc
->
instance_cnt_RUs
,
"wakeup_txfh"
)
<
0
)
return
(
-
1
);
for
(
int
i
=
0
;
i
<
gNB
->
num_RU
;
i
++
)
{
ru
=
gNB
->
RU_list
[
i
];
ru_proc
=
&
ru
->
proc
;
if
(
ru_proc
->
instance_cnt_gNBs
==
0
)
{
LOG_E
(
PHY
,
"Frame %d, subframe %d: TX FH thread busy, dropping Frame %d, subframe %d
\n
"
,
ru_proc
->
frame_tx
,
ru_proc
->
subframe_tx
,
proc
->
frame_rx
,
proc
->
subframe_rx
);
return
(
-
1
);
}
if
(
pthread_mutex_timedlock
(
&
ru_proc
->
mutex_gNBs
,
&
wait
)
!=
0
)
{
LOG_E
(
PHY
,
"[eNB] ERROR pthread_mutex_lock for eNB TX1 thread %d (IC %d)
\n
"
,
ru_proc
->
subframe_rx
&
1
,
ru_proc
->
instance_cnt_gNBs
);
exit_fun
(
"error locking mutex_gNB"
);
return
(
-
1
);
}
ru_proc
->
instance_cnt_gNBs
=
0
;
ru_proc
->
timestamp_tx
=
proc
->
timestamp_tx
;
ru_proc
->
subframe_tx
=
proc
->
subframe_tx
;
ru_proc
->
frame_tx
=
proc
->
frame_tx
;
// the thread can now be woken up
if
(
pthread_cond_signal
(
&
ru_proc
->
cond_gNBs
)
!=
0
)
{
LOG_E
(
PHY
,
"[gNB] ERROR pthread_cond_signal for gNB TXnp4 thread
\n
"
);
exit_fun
(
"ERROR pthread_cond_signal"
);
return
(
-
1
);
}
pthread_mutex_unlock
(
&
ru_proc
->
mutex_gNBs
);
}
return
(
0
);
}
int
wakeup_tx
(
PHY_VARS_gNB
*
gNB
)
{
gNB_L1_proc_t
*
proc
=&
gNB
->
proc
;
gNB_L1_rxtx_proc_t
*
L1_proc_tx
=
&
proc
->
L1_proc_tx
;
gNB_L1_rxtx_proc_t
*
L1_proc
=
&
proc
->
L1_proc
;
struct
timespec
wait
;
wait
.
tv_sec
=
0
;
wait
.
tv_nsec
=
5000000L
;
if
(
pthread_mutex_timedlock
(
&
L1_proc_tx
->
mutex
,
&
wait
)
!=
0
)
{
LOG_E
(
PHY
,
"[SCHED][eNB] ERROR locking mutex for eNB L1_thread_tx
\n
"
);
exit_fun
(
"ERROR pthread_lock"
);
return
(
-
1
);
}
while
(
L1_proc_tx
->
instance_cnt
==
0
){
pthread_cond_wait
(
&
L1_proc_tx
->
cond
,
&
L1_proc_tx
->
mutex
);
}
L1_proc_tx
->
instance_cnt
=
0
;
L1_proc_tx
->
subframe_rx
=
L1_proc
->
subframe_rx
;
L1_proc_tx
->
frame_rx
=
L1_proc
->
frame_rx
;
L1_proc_tx
->
subframe_tx
=
L1_proc
->
subframe_tx
;
L1_proc_tx
->
frame_tx
=
L1_proc
->
frame_tx
;
L1_proc_tx
->
timestamp_tx
=
L1_proc
->
timestamp_tx
;
// the thread can now be woken up
if
(
pthread_cond_signal
(
&
L1_proc_tx
->
cond
)
!=
0
)
{
LOG_E
(
PHY
,
"[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread
\n
"
);
exit_fun
(
"ERROR pthread_cond_signal"
);
return
(
-
1
);
}
pthread_mutex_unlock
(
&
L1_proc_tx
->
mutex
);
return
(
0
);
}
int
wakeup_rxtx
(
PHY_VARS_gNB
*
gNB
,
RU_t
*
ru
)
{
...
...
@@ -619,13 +764,15 @@ void init_gNB_proc(int inst) {
// pthread_attr_init( &proc->attr_te);
pthread_attr_init
(
&
L1_proc
->
attr
);
pthread_attr_init
(
&
L1_proc_tx
->
attr
);
attr0
=
&
L1_proc
->
attr
;
attr1
=
&
L1_proc_tx
->
attr
;
LOG_I
(
PHY
,
"gNB->single_thread_flag:%d
\n
"
,
gNB
->
single_thread_flag
);
/*
if (get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) {
pthread_create( &L1_proc->pthread, attr0, L1_thread, proc );
pthread_create( &L1_proc_tx->pthread, attr1, L1_thread_tx, proc);
}
*/
if
(
get_thread_parallel_conf
()
==
PARALLEL_RU_L1_SPLIT
||
get_thread_parallel_conf
()
==
PARALLEL_RU_L1_TRX_SPLIT
)
{
pthread_create
(
&
L1_proc
->
pthread
,
attr0
,
gNB_
L1_thread
,
proc
);
pthread_create
(
&
L1_proc_tx
->
pthread
,
attr1
,
gNB_
L1_thread_tx
,
proc
);
}
//pthread_create( &proc->pthread_prach, attr_prach, gNB_thread_prach, gNB );
char
name
[
16
];
...
...
@@ -693,8 +840,7 @@ void kill_gNB_proc(int inst) {
LOG_I
(
PHY
,
"Destroying UL_INFO mutex
\n
"
);
pthread_mutex_destroy
(
&
gNB
->
UL_INFO_mutex
);
int
i
;
if
((
get_thread_parallel_conf
()
==
PARALLEL_RU_L1_SPLIT
||
get_thread_parallel_conf
()
==
PARALLEL_RU_L1_TRX_SPLIT
)
&&
nfapi_mode
!=
2
)
{
if
(
get_thread_parallel_conf
()
==
PARALLEL_RU_L1_SPLIT
||
get_thread_parallel_conf
()
==
PARALLEL_RU_L1_TRX_SPLIT
)
{
LOG_I
(
PHY
,
"Joining L1_proc mutex/cond
\n
"
);
pthread_join
(
L1_proc
->
pthread
,
(
void
**
)
&
status
);
LOG_I
(
PHY
,
"Joining L1_proc_tx mutex/cond
\n
"
);
...
...
targets/RT/USER/nr-ru.c
View file @
b1a4d4ea
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