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
de32c389
Commit
de32c389
authored
Oct 25, 2018
by
Wang Tsu-Han
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
applying new mechanism for communication between threads
parent
2104817a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
47 deletions
+70
-47
targets/RT/USER/lte-enb.c
targets/RT/USER/lte-enb.c
+45
-34
targets/RT/USER/lte-ru.c
targets/RT/USER/lte-ru.c
+25
-13
No files found.
targets/RT/USER/lte-enb.c
View file @
de32c389
...
...
@@ -162,7 +162,7 @@ extern void add_subframe(uint16_t *frameP, uint16_t *subframeP, int offset);
static
inline
int
rxtx
(
PHY_VARS_eNB
*
eNB
,
eNB_rxtx_proc_t
*
proc
,
char
*
thread_name
)
{
start_meas
(
&
softmodem_stats_rxtx_sf
);
eNB_rxtx_proc_t
*
L1_proc_tx
=
&
eNB
->
proc
.
L1_proc_tx
;
//
eNB_rxtx_proc_t *L1_proc_tx = &eNB->proc.L1_proc_tx;
// *******************************************************************
...
...
@@ -223,14 +223,30 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER
,
1
);
//#TODO
if
(
get_thread_parallel_conf
()
==
PARALLEL_RU_L1_TRX_SPLIT
){
if
(
wait_on_condition
(
&
L1_proc_tx
->
mutex
,
&
L1_proc_tx
->
cond
,
&
L1_proc_tx
->
instance_cnt
,
"wakeup_tx"
)
<
0
)
{
LOG_E
(
PHY
,
"Frame %d, subframe %d: TX1 not ready
\n
"
,
L1_proc_tx
->
frame_rx
,
L1_proc_tx
->
subframe_rx
);
/*//#TODO
if(get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT)
{
if (pthread_mutex_lock(mutex) != 0) {
LOG_E(PHY, "[SCHED][eNB] ERROR locking mutex for eNB L1_thread_tx\n");
exit_fun("ERROR pthread_lock");
return(-1);
}
if
(
release_thread
(
&
L1_proc_tx
->
mutex
,
&
L1_proc_tx
->
instance_cnt
,
"wakeup_tx"
)
<
0
)
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;
if (pthread_cond_signal(&L1_proc_tx->cond) != 0) {
LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB L1_thread_tx\n");
exit_fun( "ERROR pthread_cond_signal" );
return(-1);
}
if (pthread_mutex_unlock(mutex) != 0) {
LOG_E(PHY,"[SCHED][eNB] error unlocking mutex for %s\n",name);
exit_fun("ERROR pthread_unlock");
return(-1);
}
}*/
pthread_mutex_lock
(
&
eNB
->
UL_INFO_mutex
);
...
...
@@ -331,18 +347,16 @@ static void* L1_thread_tx(void* param) {
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME
(
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX1_ENB
,
proc
->
frame_rx
);
phy_procedures_eNB_TX
(
eNB
,
proc
,
1
);
if
(
release_thread
(
&
proc
->
mutex
,
&
proc
->
instance_cnt
,
thread_name
)
<
0
)
break
;
//#TODO
pthread_mutex_lock
(
&
proc
->
mutex
);
proc
->
instance_cnt
++
;
proc
->
instance_cnt
=
-
1
;
// the thread can now be woken up
if
(
pthread_cond_signal
(
&
proc
->
cond
)
!=
0
)
{
LOG_E
(
PHY
,
"[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread
\n
"
);
exit_fun
(
"ERROR pthread_cond_signal"
);
}
pthread_mutex_unlock
(
&
proc
->
mutex
);
wakeup_txfh
(
proc
,
eNB
_proc
->
ru_proc
);
wakeup_txfh
(
proc
,
eNB
->
proc
.
ru_proc
);
}
return
0
;
...
...
@@ -414,14 +428,6 @@ static void* L1_thread( void* param ) {
}
if
(
release_thread
(
&
proc
->
mutex
,
&
proc
->
instance_cnt
,
thread_name
)
<
0
)
break
;
pthread_mutex_lock
(
&
proc
->
mutex
);
proc
->
instance_cnt
++
;
// the thread can now be woken up
if
(
pthread_cond_signal
(
&
proc
->
cond
)
!=
0
)
{
LOG_E
(
PHY
,
"[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread
\n
"
);
exit_fun
(
"ERROR pthread_cond_signal"
);
}
pthread_mutex_unlock
(
&
proc
->
mutex
);
if
(
nfapi_mode
!=
2
){
if
(
get_thread_parallel_conf
()
==
PARALLEL_RU_L1_TRX_SPLIT
)
wakeup_tx
(
eNB
,
eNB
->
proc
.
ru_proc
);
else
if
(
get_thread_parallel_conf
()
==
PARALLEL_RU_L1_SPLIT
)
...
...
@@ -474,13 +480,13 @@ int wakeup_txfh(eNB_rxtx_proc_t *proc,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
(
&
ru_proc
->
mutex_eNBs
,
&
ru_proc
->
cond_eNBs
,
&
ru_proc
->
ru_tx_ready
,
"wakeup_txfh"
)
<
0
)
{
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
"
,
ru_proc
->
frame_tx
,
ru_proc
->
subframe_tx
);
return
(
-
1
);
}
if
(
release_thread
(
&
ru_proc
->
mutex_eNBs
,
&
ru_proc
->
ru_tx_ready
,
"wakeup_txfh"
)
<
0
)
return
(
-
1
);
if
(
release_thread
(
&
proc
->
mutex_RUs
,
&
proc
->
instance_cnt_RUs
,
"wakeup_txfh"
)
<
0
)
return
(
-
1
);
if
(
ru_proc
->
instance_cnt_eNBs
==
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
);
...
...
@@ -492,10 +498,12 @@ int wakeup_txfh(eNB_rxtx_proc_t *proc,RU_proc_t *ru_proc) {
return
(
-
1
);
}
++
ru_proc
->
instance_cnt_eNBs
;
//for(num_RUs)
ru_proc
->
instance_cnt_eNBs
=
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_eNBs
)
!=
0
)
{
...
...
@@ -522,19 +530,16 @@ int wakeup_tx(PHY_VARS_eNB *eNB,RU_proc_t *ru_proc) {
wait
.
tv_nsec
=
5000000L
;
if
(
L1_proc_tx
->
instance_cnt
==
0
)
{
LOG_E
(
PHY
,
"Frame %d, subframe %d: TX1 thread busy, dropping
\n
"
,
L1_proc_tx
->
frame_rx
,
L1_proc_tx
->
subframe_rx
);
return
(
-
1
);
}
if
(
pthread_mutex_timedlock
(
&
L1_proc_tx
->
mutex
,
&
wait
)
!=
0
)
{
LOG_E
(
PHY
,
"[eNB] ERROR pthread_mutex_lock for eNB TX1 thread %d (IC %d)
\n
"
,
L1_proc_tx
->
subframe_rx
&
1
,
L1_proc_tx
->
instance_cnt
);
exit_fun
(
"error locking mutex_tx"
);
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
;
L1_proc_tx
->
instance_cnt
=
0
;
L1_proc_tx
->
subframe_rx
=
L1_proc
->
subframe_rx
;
...
...
@@ -899,6 +904,8 @@ void init_eNB_proc(int inst) {
L1_proc_tx
=
&
proc
->
L1_proc_tx
;
L1_proc
->
instance_cnt
=
-
1
;
L1_proc_tx
->
instance_cnt
=
-
1
;
L1_proc
->
instance_cnt_RUs
=
0
;
L1_proc_tx
->
instance_cnt_RUs
=
0
;
proc
->
instance_cnt_prach
=
-
1
;
proc
->
instance_cnt_asynch_rxtx
=
-
1
;
proc
->
instance_cnt_synch
=
-
1
;
...
...
@@ -914,6 +921,10 @@ void init_eNB_proc(int inst) {
pthread_mutex_init
(
&
L1_proc_tx
->
mutex
,
NULL
);
pthread_cond_init
(
&
L1_proc
->
cond
,
NULL
);
pthread_cond_init
(
&
L1_proc_tx
->
cond
,
NULL
);
pthread_mutex_init
(
&
L1_proc
->
mutex_RUs
,
NULL
);
pthread_mutex_init
(
&
L1_proc_tx
->
mutex_RUs
,
NULL
);
pthread_cond_init
(
&
L1_proc
->
cond_RUs
,
NULL
);
pthread_cond_init
(
&
L1_proc_tx
->
cond_RUs
,
NULL
);
pthread_mutex_init
(
&
proc
->
mutex_prach
,
NULL
);
pthread_mutex_init
(
&
proc
->
mutex_asynch_rxtx
,
NULL
);
...
...
@@ -1009,7 +1020,7 @@ void kill_eNB_proc(int inst) {
PHY_VARS_eNB
*
eNB
;
eNB_proc_t
*
proc
;
eNB_rxtx_proc_t
*
L1_proc
,
*
L1_proc_tx
;
int
i
;
for
(
int
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
eNB
=
RC
.
eNB
[
inst
][
CC_id
];
...
...
targets/RT/USER/lte-ru.c
View file @
de32c389
...
...
@@ -1249,12 +1249,12 @@ void do_ru_synch(RU_t *ru) {
void
wakeup_
eNB
s
(
RU_t
*
ru
)
{
void
wakeup_
L1
s
(
RU_t
*
ru
)
{
int
i
;
PHY_VARS_eNB
**
eNB_list
=
ru
->
eNB_list
;
LOG_D
(
PHY
,
"wakeup_
eNB
s (num %d) for RU %d ru->eNB_top:%p
\n
"
,
ru
->
num_eNB
,
ru
->
idx
,
ru
->
eNB_top
);
LOG_D
(
PHY
,
"wakeup_
L1
s (num %d) for RU %d ru->eNB_top:%p
\n
"
,
ru
->
num_eNB
,
ru
->
idx
,
ru
->
eNB_top
);
if
(
ru
->
num_eNB
==
1
&&
ru
->
eNB_top
!=
0
&&
get_thread_parallel_conf
()
==
PARALLEL_SINGLE_THREAD
)
{
...
...
@@ -1529,8 +1529,12 @@ volatile int16_t phy_tx_end;
#endif
static
void
*
ru_thread_tx
(
void
*
param
)
{
RU_t
*
ru
=
(
RU_t
*
)
param
;
RU_proc_t
*
proc
=
&
ru
->
proc
;
RU_t
*
ru
=
(
RU_t
*
)
param
;
RU_proc_t
*
proc
=
&
ru
->
proc
;
PHY_VARS_eNB
*
eNB
;
eNB_proc_t
*
eNB_proc
;
eNB_rxtx_proc_t
*
L1_proc
;
cpu_set_t
cpuset
;
CPU_ZERO
(
&
cpuset
);
...
...
@@ -1555,6 +1559,7 @@ static void* ru_thread_tx( void* param ) {
// wait until eNBs are finished subframe RX n and TX n+4
wait_on_condition
(
&
proc
->
mutex_eNBs
,
&
proc
->
cond_eNBs
,
&
proc
->
instance_cnt_eNBs
,
"ru_thread_tx"
);
if
(
oai_exit
)
break
;
printf
(
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~ru_thread_tx is waken up %d.%d having L1 %d
\n
"
,
proc
->
frame_tx
,
proc
->
subframe_tx
,
ru
->
num_eNB
);
// do TX front-end processing if needed (precoding and/or IDFTs)
if
(
ru
->
feptx_prec
)
ru
->
feptx_prec
(
ru
);
...
...
@@ -1568,15 +1573,22 @@ static void* ru_thread_tx( void* param ) {
if
(
ru
->
fh_north_out
)
ru
->
fh_north_out
(
ru
);
}
release_thread
(
&
proc
->
mutex_eNBs
,
&
proc
->
instance_cnt_eNBs
,
"ru_thread_tx"
);
pthread_mutex_lock
(
&
proc
->
mutex_eNBs
);
proc
->
ru_tx_ready
++
;
// the thread can now be woken up
if
(
pthread_cond_signal
(
&
proc
->
cond_eNBs
)
!=
0
)
{
LOG_E
(
PHY
,
"[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread
\n
"
);
exit_fun
(
"ERROR pthread_cond_signal"
);
for
(
int
i
=
0
;
i
<
ru
->
num_eNB
;
i
++
)
{
eNB
=
ru
->
eNB_list
[
i
];
eNB_proc
=
&
eNB
->
proc
;
L1_proc
=
(
get_thread_parallel_conf
()
==
PARALLEL_RU_L1_TRX_SPLIT
)
?
&
eNB_proc
->
L1_proc_tx
:
&
eNB_proc
->
L1_proc
;
char
*
L1_proc_name
=
(
get_thread_parallel_conf
()
==
PARALLEL_RU_L1_TRX_SPLIT
)
?
"L1_proc_tx"
:
"L1_proc"
;
printf
(
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~ru_thread_tx signaling to eNB_list[%d] with %s IC_RU %d
\n
"
,
i
,
L1_proc_name
,
L1_proc
->
instance_cnt_RUs
);
pthread_mutex_lock
(
&
L1_proc
->
mutex_RUs
);
L1_proc
->
instance_cnt_RUs
=
0
;
// the thread can now be woken up
if
(
pthread_cond_signal
(
&
L1_proc
->
cond_RUs
)
!=
0
)
{
LOG_E
(
PHY
,
"[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread
\n
"
);
exit_fun
(
"ERROR pthread_cond_signal"
);
}
pthread_mutex_unlock
(
&
L1_proc
->
mutex_RUs
);
}
pthread_mutex_unlock
(
&
proc
->
mutex_eNBs
);
}
release_thread
(
&
proc
->
mutex_FH1
,
&
proc
->
instance_cnt_FH1
,
"ru_thread_tx"
);
return
0
;
...
...
@@ -1785,7 +1797,7 @@ static void* ru_thread( void* param ) {
#endif
// wakeup all eNB processes waiting for this RU
if
(
ru
->
num_eNB
>
0
)
wakeup_
eNB
s
(
ru
);
if
(
ru
->
num_eNB
>
0
)
wakeup_
L1
s
(
ru
);
#ifndef PHY_TX_THREAD
if
(
get_thread_parallel_conf
()
==
PARALLEL_SINGLE_THREAD
||
ru
->
num_eNB
==
0
){
...
...
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