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
wangwenhui
OpenXG-RAN
Commits
bc2ee097
Commit
bc2ee097
authored
Oct 26, 2018
by
magounak
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/L1_renaming' into ru_rau_enhancement_L1_renaming
parents
42687dfe
de32c389
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
222 additions
and
211 deletions
+222
-211
nfapi/oai_integration/nfapi_pnf.c
nfapi/oai_integration/nfapi_pnf.c
+4
-4
nfapi/oai_integration/nfapi_vnf.c
nfapi/oai_integration/nfapi_vnf.c
+13
-13
openair1/PHY/TOOLS/lte_phy_scope.c
openair1/PHY/TOOLS/lte_phy_scope.c
+1
-1
openair1/PHY/defs_eNB.h
openair1/PHY/defs_eNB.h
+13
-8
openair1/SCHED/fapi_l1.c
openair1/SCHED/fapi_l1.c
+1
-1
targets/RT/USER/lte-enb.c
targets/RT/USER/lte-enb.c
+152
-161
targets/RT/USER/lte-ru.c
targets/RT/USER/lte-ru.c
+38
-23
No files found.
nfapi/oai_integration/nfapi_pnf.c
View file @
bc2ee097
...
...
@@ -741,7 +741,7 @@ int pnf_phy_hi_dci0_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_hi_dci0_request_t*
//phy_info* phy = (phy_info*)(pnf_p7->user_data);
struct
PHY_VARS_eNB_s
*
eNB
=
RC
.
eNB
[
0
][
0
];
eNB_rxtx_proc_t
*
proc
=
&
eNB
->
proc
.
proc_rxtx
[
0
]
;
eNB_rxtx_proc_t
*
proc
=
&
eNB
->
proc
.
L1_proc
;
for
(
int
i
=
0
;
i
<
req
->
hi_dci0_request_body
.
number_of_dci
+
req
->
hi_dci0_request_body
.
number_of_hi
;
i
++
)
{
...
...
@@ -798,7 +798,7 @@ int pnf_phy_dl_config_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_dl_config_request
int
sf
=
NFAPI_SFNSF2SF
(
req
->
sfn_sf
);
struct
PHY_VARS_eNB_s
*
eNB
=
RC
.
eNB
[
0
][
0
];
eNB_rxtx_proc_t
*
proc
=
&
eNB
->
proc
.
proc_rxtx
[
0
]
;
eNB_rxtx_proc_t
*
proc
=
&
eNB
->
proc
.
L1_proc
;
nfapi_dl_config_request_pdu_t
*
dl_config_pdu_list
=
req
->
dl_config_request_body
.
dl_config_pdu_list
;
LTE_eNB_PDCCH
*
pdcch_vars
=
&
eNB
->
pdcch_vars
[
sf
&
1
];
...
...
@@ -869,7 +869,7 @@ int pnf_phy_dl_config_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_dl_config_request
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() DLSCH:pdu_index:%d handle_nfapi_dlsch_pdu(eNB, proc_rxtx, dlsch_pdu, transport_blocks:%d sdu:%p) eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols:%d\n", __FUNCTION__, rel8_pdu->pdu_index, rel8_pdu->transport_blocks, dlsch_sdu, eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols);
handle_nfapi_dlsch_pdu
(
eNB
,
sfn
,
sf
,
&
eNB
->
proc
.
proc_rxtx
[
0
]
,
&
dl_config_pdu_list
[
i
],
rel8_pdu
->
transport_blocks
-
1
,
dlsch_sdu
);
handle_nfapi_dlsch_pdu
(
eNB
,
sfn
,
sf
,
&
eNB
->
proc
.
L1_proc
,
&
dl_config_pdu_list
[
i
],
rel8_pdu
->
transport_blocks
-
1
,
dlsch_sdu
);
}
else
{
...
...
@@ -945,7 +945,7 @@ int pnf_phy_ul_config_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_ul_config_request
uint16_t
curr_sf
=
NFAPI_SFNSF2SF
(
req
->
sfn_sf
);
struct
PHY_VARS_eNB_s
*
eNB
=
RC
.
eNB
[
0
][
0
];
eNB_rxtx_proc_t
*
proc
=
&
eNB
->
proc
.
proc_rxtx
[
0
]
;
eNB_rxtx_proc_t
*
proc
=
&
eNB
->
proc
.
L1_proc
;
nfapi_ul_config_request_pdu_t
*
ul_config_pdu_list
=
req
->
ul_config_request_body
.
ul_config_pdu_list
;
for
(
int
i
=
0
;
i
<
req
->
ul_config_request_body
.
number_of_pdus
;
i
++
)
{
...
...
nfapi/oai_integration/nfapi_vnf.c
View file @
bc2ee097
...
...
@@ -345,7 +345,7 @@ int wake_eNB_rxtx(PHY_VARS_eNB *eNB, uint16_t sfn, uint16_t sf) {
eNB_proc_t
*
proc
=&
eNB
->
proc
;
eNB_rxtx_proc_t
*
proc_rxtx
=&
proc
->
proc_rxtx
[
sf
&
1
]
;
eNB_rxtx_proc_t
*
L1_proc
=
(
sf
&
1
)
?
&
proc
->
L1_proc
:
&
proc
->
L1_proc_tx
;
LTE_DL_FRAME_PARMS
*
fp
=
&
eNB
->
frame_parms
;
...
...
@@ -359,8 +359,8 @@ int wake_eNB_rxtx(PHY_VARS_eNB *eNB, uint16_t sfn, uint16_t sf) {
// wake up TX for subframe n+sf_ahead
// lock the TX mutex and make sure the thread is ready
if
(
pthread_mutex_timedlock
(
&
proc_rxtx
->
mutex_rxt
x
,
&
wait
)
!=
0
)
{
LOG_E
(
PHY
,
"[eNB] ERROR pthread_mutex_lock for eNB RXTX thread %d (IC %d)
\n
"
,
proc_rxtx
->
subframe_rx
&
1
,
proc_rxtx
->
instance_cnt_rxtx
);
if
(
pthread_mutex_timedlock
(
&
L1_proc
->
mute
x
,
&
wait
)
!=
0
)
{
LOG_E
(
PHY
,
"[eNB] ERROR pthread_mutex_lock for eNB RXTX thread %d (IC %d)
\n
"
,
L1_proc
->
subframe_rx
&
1
,
L1_proc
->
instance_cnt
);
exit_fun
(
"error locking mutex_rxtx"
);
return
(
-
1
);
}
...
...
@@ -379,9 +379,9 @@ int wake_eNB_rxtx(PHY_VARS_eNB *eNB, uint16_t sfn, uint16_t sf) {
if
(
old_sf
==
0
&&
old_sfn
%
100
==
0
)
LOG_W
(
PHY
,
"[eNB] sfn/sf:%d%d old_sfn/sf:%d%d proc[rx:%d%d]
\n
"
,
sfn
,
sf
,
old_sfn
,
old_sf
,
proc
->
frame_rx
,
proc
->
subframe_rx
);
}
++
proc_rxtx
->
instance_cnt_rxtx
;
++
L1_proc
->
instance_cnt
;
//LOG_D( PHY,"[VNF-subframe_ind] sfn/sf:%d:%d proc[frame_rx:%d subframe_rx:%d]
proc_rxtx->instance_cnt_rxtx:%d \n", sfn, sf, proc->frame_rx, proc->subframe_rx, proc_rxtx
->instance_cnt_rxtx);
//LOG_D( PHY,"[VNF-subframe_ind] sfn/sf:%d:%d proc[frame_rx:%d subframe_rx:%d]
L1_proc->instance_cnt_rxtx:%d \n", sfn, sf, proc->frame_rx, proc->subframe_rx, L1_proc
->instance_cnt_rxtx);
// We have just received and processed the common part of a subframe, say n.
// TS_rx is the last received timestamp (start of 1st slot), TS_tx is the desired
...
...
@@ -389,23 +389,23 @@ int wake_eNB_rxtx(PHY_VARS_eNB *eNB, uint16_t sfn, uint16_t sf) {
// The last (TS_rx mod samples_per_frame) was n*samples_per_tti,
// we want to generate subframe (n+N), so TS_tx = TX_rx+N*samples_per_tti,
// and proc->subframe_tx = proc->subframe_rx+sf_ahead
proc_rxtx
->
timestamp_tx
=
proc
->
timestamp_rx
+
(
sf_ahead
*
fp
->
samples_per_tti
);
proc_rxtx
->
frame_rx
=
proc
->
frame_rx
;
proc_rxtx
->
subframe_rx
=
proc
->
subframe_rx
;
proc_rxtx
->
frame_tx
=
(
proc_rxtx
->
subframe_rx
>
(
9
-
sf_ahead
))
?
(
proc_rxtx
->
frame_rx
+
1
)
&
1023
:
proc_rxtx
->
frame_rx
;
proc_rxtx
->
subframe_tx
=
(
proc_rxtx
->
subframe_rx
+
sf_ahead
)
%
10
;
L1_proc
->
timestamp_tx
=
proc
->
timestamp_rx
+
(
sf_ahead
*
fp
->
samples_per_tti
);
L1_proc
->
frame_rx
=
proc
->
frame_rx
;
L1_proc
->
subframe_rx
=
proc
->
subframe_rx
;
L1_proc
->
frame_tx
=
(
L1_proc
->
subframe_rx
>
(
9
-
sf_ahead
))
?
(
L1_proc
->
frame_rx
+
1
)
&
1023
:
L1_proc
->
frame_rx
;
L1_proc
->
subframe_tx
=
(
L1_proc
->
subframe_rx
+
sf_ahead
)
%
10
;
//LOG_D(PHY, "sfn/sf:%d%d proc[rx:%d%d]
proc_rxtx[instance_cnt_rxtx:%d rx:%d%d] About to wake rxtx thread\n\n", sfn, sf, proc->frame_rx, proc->subframe_rx, proc_rxtx->instance_cnt_rxtx, proc_rxtx->frame_rx, proc_rxtx
->subframe_rx);
//LOG_D(PHY, "sfn/sf:%d%d proc[rx:%d%d]
L1_proc[instance_cnt_rxtx:%d rx:%d%d] About to wake rxtx thread\n\n", sfn, sf, proc->frame_rx, proc->subframe_rx, L1_proc->instance_cnt_rxtx, L1_proc->frame_rx, L1_proc
->subframe_rx);
// the thread can now be woken up
if
(
pthread_cond_signal
(
&
proc_rxtx
->
cond_rxtx
)
!=
0
)
{
if
(
pthread_cond_signal
(
&
L1_proc
->
cond
)
!=
0
)
{
LOG_E
(
PHY
,
"[eNB] ERROR pthread_cond_signal for eNB RXn-TXnp4 thread
\n
"
);
exit_fun
(
"ERROR pthread_cond_signal"
);
return
(
-
1
);
}
//LOG_D(PHY,"%s() About to attempt pthread_mutex_unlock\n", __FUNCTION__);
pthread_mutex_unlock
(
&
proc_rxtx
->
mutex_rxt
x
);
pthread_mutex_unlock
(
&
L1_proc
->
mute
x
);
//LOG_D(PHY,"%s() UNLOCKED pthread_mutex_unlock\n", __FUNCTION__);
return
(
0
);
...
...
openair1/PHY/TOOLS/lte_phy_scope.c
View file @
bc2ee097
...
...
@@ -178,7 +178,7 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form,
float
time
[
FRAME_LENGTH_COMPLEX_SAMPLES
];
float
time2
[
2048
];
float
freq
[
nsymb_ce
*
nb_antennas_rx
*
nb_antennas_tx
];
int
frame
=
phy_vars_enb
->
proc
.
proc_rxtx
[
0
]
.
frame_tx
;
int
frame
=
phy_vars_enb
->
proc
.
L1_proc
.
frame_tx
;
uint32_t
total_dlsch_bitrate
=
phy_vars_enb
->
total_dlsch_bitrate
;
int
coded_bits_per_codeword
=
0
;
uint8_t
harq_pid
;
// in TDD config 3 it is sf-2, i.e., can be 0,1,2
...
...
openair1/PHY/defs_eNB.h
View file @
bc2ee097
...
...
@@ -730,19 +730,24 @@ typedef struct {
int
frame_rx
;
/// \brief Instance count for RXn-TXnp4 processing thread.
/// \internal This variable is protected by \ref mutex_rxtx.
int
instance_cnt
_rxtx
;
int
instance_cnt
;
/// pthread structure for RXn-TXnp4 processing thread
pthread_t
pthread
_rxtx
;
pthread_t
pthread
;
/// pthread attributes for RXn-TXnp4 processing thread
pthread_attr_t
attr
_rxtx
;
pthread_attr_t
attr
;
/// condition variable for tx processing thread
pthread_cond_t
cond
_rxtx
;
pthread_cond_t
cond
;
/// mutex for RXn-TXnp4 processing thread
pthread_mutex_t
mutex
_rxtx
;
pthread_mutex_t
mutex
;
/// scheduling parameters for RXn-TXnp4 thread
struct
sched_param
sched_param_rxtx
;
/// pipeline ready state
int
pipe_ready
;
/// \internal This variable is protected by \ref mutex_RUs.
int
instance_cnt_RUs
;
/// condition variable for tx processing thread
pthread_cond_t
cond_RUs
;
/// mutex for RXn-TXnp4 processing thread
pthread_mutex_t
mutex_RUs
;
}
eNB_rxtx_proc_t
;
typedef
struct
{
...
...
@@ -910,7 +915,7 @@ typedef struct eNB_proc_t_s {
/// parameters for turbo-encoding worker thread
te_params
tep
[
3
];
/// set of scheduling variables RXn-TXnp4 threads
eNB_rxtx_proc_t
proc_rxtx
[
2
]
;
eNB_rxtx_proc_t
L1_proc
,
L1_proc_tx
;
/// stats thread pthread descriptor
pthread_t
process_stats_thread
;
/// for waking up tx procedure
...
...
openair1/SCHED/fapi_l1.c
View file @
bc2ee097
...
...
@@ -670,7 +670,7 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
eNB
=
RC
.
eNB
[
Mod_id
][
CC_id
];
fp
=
&
eNB
->
frame_parms
;
proc
=
&
eNB
->
proc
.
proc_rxtx
[
0
]
;
proc
=
&
eNB
->
proc
.
L1_proc
;
/* TODO: check that following line is correct - in the meantime it is disabled */
//if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)==SF_UL)) return;
...
...
targets/RT/USER/lte-enb.c
View file @
bc2ee097
...
...
@@ -174,7 +174,6 @@ 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
);
// *******************************************************************
LOG_I
(
PHY
,
"ENTERED rxtx
\n
"
);
if
(
nfapi_mode
==
1
)
{
...
...
@@ -233,14 +232,30 @@ LOG_I(PHY,"ENTERED rxtx\n");
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER
,
1
);
if
(
get_thread_parallel_conf
()
==
PARALLEL_RU_L1_TRX_SPLIT
){
if
(
wait_on_condition
(
&
proc
[
1
].
mutex_rxtx
,
&
proc
[
1
].
cond_rxtx
,
&
proc
[
1
].
pipe_ready
,
"wakeup_tx"
)
<
0
)
{
LOG_E
(
PHY
,
"Frame %d, subframe %d: TX1 not ready
\n
"
,
proc
[
1
].
frame_rx
,
proc
[
1
].
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);
}
LOG_D
(
PHY
,
"Passed rxtx, proc1->cond_rxtx, frame_rx %d, subframe_rx %d, frame_tx %d, subframe_tx %d
\n
"
,
proc
->
frame_rx
,
proc
->
subframe_rx
,
proc
->
frame_tx
,
proc
->
subframe_tx
);
if
(
release_thread
(
&
proc
[
1
].
mutex_rxtx
,
&
proc
[
1
].
pipe_ready
,
"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
);
...
...
@@ -315,25 +330,22 @@ LOG_I(PHY,"ENTERED rxtx\n");
}
static
void
*
tx_thread
(
void
*
param
)
{
PHY_VARS_eNB
*
eNB
=
(
PHY_VARS_eNB
*
)
param
;
eNB_proc_t
*
eNB_proc
=
&
eNB
->
proc
;
eNB_rxtx_proc_t
*
proc
=
&
eNB_proc
->
proc_rxtx
[
1
]
;
//
PHY_VARS_eNB *eNB = RC.eNB[0][proc->CC_id];
LOG_I
(
PHY
,
"ENTERED tx_thread
\n
"
);
static
void
*
L1_thread_tx
(
void
*
param
)
{
eNB_proc_t
*
eNB_proc
=
(
eNB_proc_t
*
)
param
;
eNB_rxtx_proc_t
*
proc
=
&
eNB_proc
->
L1_proc_tx
;
PHY_VARS_eNB
*
eNB
=
RC
.
eNB
[
0
][
proc
->
CC_id
];
char
thread_name
[
100
];
sprintf
(
thread_name
,
"TXnp4_%d
"
,
&
eNB
->
proc
.
proc_rxtx
[
0
]
==
proc
?
0
:
1
);
sprintf
(
thread_name
,
"TXnp4_%d
\n
"
,
&
eNB
->
proc
.
L1_proc
==
proc
?
0
:
1
);
thread_top_init
(
thread_name
,
1
,
470000
,
500000
,
500000
);
//wait_sync("tx_thread");
while
(
!
oai_exit
)
{
LOG_D
(
PHY
,
"Entering tx_thread, proc1->cond_rxtx, proc1->instance_cnt_rxtx, frame_rx %d, subframe_rx %d, frame_tx %d, subframe_tx %d
\n
"
,
proc
->
frame_rx
,
proc
->
subframe_rx
,
proc
->
frame_tx
,
proc
->
subframe_tx
);
if
(
wait_on_condition
(
&
proc
->
mutex_rxtx
,
&
proc
->
cond_rxtx
,
&
proc
->
instance_cnt_rxtx
,
thread_name
)
<
0
)
break
;
LOG_D
(
PHY
,
"Passed tx_thread proc1->cond_rxtx, frame_rx %d, subframe_rx %d, frame_tx %d, subframe_tx %d
\n
"
,
proc
->
frame_rx
,
proc
->
subframe_rx
,
proc
->
frame_tx
,
proc
->
subframe_tx
);
if
(
oai_exit
)
break
;
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
...
...
@@ -345,18 +357,16 @@ if (oai_exit) break;
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_rxtx
,
&
proc
->
instance_cnt_rxtx
,
thread_name
)
<
0
)
break
;
pthread_mutex_lock
(
&
proc
->
mutex_rxtx
);
proc
->
pipe_ready
++
;
pthread_mutex_lock
(
&
proc
->
mutex
);
proc
->
instance_cnt
=
-
1
;
// the thread can now be woken up
if
(
pthread_cond_signal
(
&
proc
->
cond
_rxtx
)
!=
0
)
{
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"
);
}
LOG_I
(
PHY
,
"Sent tx_thread, proc1->cond_rxtx to tx_thread, frame_rx %d, subframe_rx %d, frame_tx %d, subframe_tx %d
\n
"
,
proc
->
frame_rx
,
proc
->
subframe_rx
,
proc
->
frame_tx
,
proc
->
subframe_tx
);
pthread_mutex_unlock
(
&
proc
->
mutex_rxtx
);
wakeup_txfh
(
proc
,
eNB
);
pthread_mutex_unlock
(
&
proc
->
mutex
);
wakeup_txfh
(
proc
,
eNB
->
proc
.
ru_proc
);
}
return
0
;
...
...
@@ -368,7 +378,7 @@ if (oai_exit) break;
* \returns a pointer to an int. The storage is not on the heap and must not be freed.
*/
static
void
*
eNB_thread_rxtx
(
void
*
param
)
{
static
void
*
L1_thread
(
void
*
param
)
{
static
int
eNB_thread_rxtx_status
;
//eNB_proc_t *eNB_proc = (eNB_proc_t*)param;
...
...
@@ -379,9 +389,8 @@ LOG_I(PHY,"ENTERED eNB_thread_rxtx\n");
proc
=
(
eNB_rxtx_proc_t
*
)
param
;
}
else
{
PHY_VARS_eNB
*
eNB
=
(
PHY_VARS_eNB
*
)
param
;
eNB_proc_t
*
eNB_proc
=
&
eNB
->
proc
;
proc
=
&
eNB_proc
->
proc_rxtx
[
0
];
eNB_proc_t
*
eNB_proc
=
(
eNB_proc_t
*
)
param
;
proc
=
&
eNB_proc
->
L1_proc
;
}
...
...
@@ -397,7 +406,7 @@ LOG_I(PHY,"ENTERED eNB_thread_rxtx\n");
eNB_thread_rxtx_status
=
0
;
sprintf
(
thread_name
,
"RXn_TXnp4_%d
"
,
&
eNB
->
proc
.
proc_rxtx
[
0
]
==
proc
?
0
:
1
);
sprintf
(
thread_name
,
"RXn_TXnp4_%d
\n
"
,
&
eNB
->
proc
.
L1_proc
==
proc
?
0
:
1
);
thread_top_init
(
thread_name
,
1
,
470000
,
500000
,
500000
);
pthread_setname_np
(
pthread_self
(),
"rxtx processing"
);
LOG_I
(
PHY
,
"thread rxtx created id=%ld
\n
"
,
syscall
(
__NR_gettid
));
...
...
@@ -409,9 +418,9 @@ LOG_I(PHY,"ENTERED eNB_thread_rxtx\n");
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0
+
(
proc
->
subframe_rx
&
1
),
0
);
T
(
T_ENB_MASTER_TICK
,
T_INT
(
0
),
T_INT
(
proc
->
frame_rx
),
T_INT
(
proc
->
subframe_rx
));
LOG_D
(
PHY
,
"Entering eNB_thread_rxtx, proc0->cond_rxtx, instance_cnt_rxtx, frame_rx %d, subframe_rx %d, frame_tx %d, subframe_tx %d
\n
"
,
proc
->
frame_rx
,
proc
->
subframe_rx
,
proc
->
frame_tx
,
proc
->
subframe_tx
);
if
(
wait_on_condition
(
&
proc
->
mutex
_rxtx
,
&
proc
->
cond_rxtx
,
&
proc
->
instance_cnt_rxtx
,
thread_name
)
<
0
)
break
;
LOG_D
(
PHY
,
"Passed eNB_thread_rxtx proc0->cond_rxtx , frame_rx %d, subframe_rx %d, frame_tx %d, subframe_tx %d
\n
"
,
proc
->
frame_rx
,
proc
->
subframe_rx
,
proc
->
frame_tx
,
proc
->
subframe_tx
);
if
(
wait_on_condition
(
&
proc
->
mutex
,
&
proc
->
cond
,
&
proc
->
instance_cnt
,
thread_name
)
<
0
)
break
;
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME
(
VCD_SIGNAL_DUMPER_VARIABLES_CPUID_ENB_THREAD_RXTX
,
sched_getcpu
());
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0
+
(
proc
->
subframe_rx
&
1
),
1
);
...
...
@@ -430,16 +439,7 @@ LOG_I(PHY,"ENTERED eNB_thread_rxtx\n");
if
(
rxtx
(
eNB
,
proc
,
thread_name
)
<
0
)
break
;
}
if
(
release_thread
(
&
proc
->
mutex_rxtx
,
&
proc
->
instance_cnt_rxtx
,
thread_name
)
<
0
)
break
;
pthread_mutex_lock
(
&
proc
->
mutex_rxtx
);
proc
->
pipe_ready
++
;
// the thread can now be woken up
if
(
pthread_cond_signal
(
&
proc
->
cond_rxtx
)
!=
0
)
{
LOG_E
(
PHY
,
"[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread
\n
"
);
exit_fun
(
"ERROR pthread_cond_signal"
);
}
LOG_I
(
PHY
,
"Sent eNB_thread_rxtx proc0-> cond_rxtx to tx_thread, frame_rx %d, subframe_rx %d, frame_tx %d, subframe_tx %d
\n
"
,
proc
->
frame_rx
,
proc
->
subframe_rx
,
proc
->
frame_tx
,
proc
->
subframe_tx
);
pthread_mutex_unlock
(
&
proc
->
mutex_rxtx
);
if
(
release_thread
(
&
proc
->
mutex
,
&
proc
->
instance_cnt
,
thread_name
)
<
0
)
break
;
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
)
...
...
@@ -462,7 +462,7 @@ LOG_I(PHY,"ENTERED eNB_thread_rxtx\n");
void
eNB_top
(
PHY_VARS_eNB
*
eNB
,
int
frame_rx
,
int
subframe_rx
,
char
*
string
,
RU_t
*
ru
)
{
eNB_proc_t
*
proc
=
&
eNB
->
proc
;
eNB_rxtx_proc_t
*
proc_rxtx
=
&
proc
->
proc_rxtx
[
0
]
;
eNB_rxtx_proc_t
*
L1_proc
=
&
proc
->
L1_proc
;
LTE_DL_FRAME_PARMS
*
fp
=
&
ru
->
frame_parms
;
RU_proc_t
*
ru_proc
=&
ru
->
proc
;
...
...
@@ -472,18 +472,16 @@ void eNB_top(PHY_VARS_eNB *eNB, int frame_rx, int subframe_rx, char *string,RU_t
if
(
!
oai_exit
)
{
T
(
T_ENB_MASTER_TICK
,
T_INT
(
0
),
T_INT
(
proc
->
frame_rx
),
T_INT
(
proc
->
subframe_rx
));
proc_rxtx
->
timestamp_tx
=
ru_proc
->
timestamp_rx
+
(
sf_ahead
*
fp
->
samples_per_tti
);
proc_rxtx
->
frame_rx
=
ru_proc
->
frame_rx
;
proc_rxtx
->
subframe_rx
=
ru_proc
->
subframe_rx
;
proc_rxtx
->
frame_tx
=
(
proc_rxtx
->
subframe_rx
>
(
9
-
sf_ahead
))
?
(
proc_rxtx
->
frame_rx
+
1
)
&
1023
:
proc_rxtx
->
frame_rx
;
proc_rxtx
->
subframe_tx
=
(
proc_rxtx
->
subframe_rx
+
sf_ahead
)
%
10
;
LOG_D
(
PHY
,
"RXTX for TX: %d.%d, RX: %d.%d
\n
"
,
proc_rxtx
->
frame_tx
,
proc_rxtx
->
subframe_tx
,
proc_rxtx
->
frame_rx
,
proc_rxtx
->
subframe_rx
);
L1_proc
->
timestamp_tx
=
ru_proc
->
timestamp_rx
+
(
sf_ahead
*
fp
->
samples_per_tti
);
L1_proc
->
frame_rx
=
ru_proc
->
frame_rx
;
L1_proc
->
subframe_rx
=
ru_proc
->
subframe_rx
;
L1_proc
->
frame_tx
=
(
L1_proc
->
subframe_rx
>
(
9
-
sf_ahead
))
?
(
L1_proc
->
frame_rx
+
1
)
&
1023
:
L1_proc
->
frame_rx
;
L1_proc
->
subframe_tx
=
(
L1_proc
->
subframe_rx
+
sf_ahead
)
%
10
;
if
(
rxtx
(
eNB
,
proc_rxtx
,
string
)
<
0
)
LOG_E
(
PHY
,
"eNB %d CC_id %d failed during execution
\n
"
,
eNB
->
Mod_id
,
eNB
->
CC_id
);
ru_proc
->
timestamp_tx
=
proc_rxtx
->
timestamp_tx
;
ru_proc
->
subframe_tx
=
proc_rxtx
->
subframe_tx
;
ru_proc
->
frame_tx
=
proc_rxtx
->
frame_tx
;
if
(
rxtx
(
eNB
,
L1_proc
,
string
)
<
0
)
LOG_E
(
PHY
,
"eNB %d CC_id %d failed during execution
\n
"
,
eNB
->
Mod_id
,
eNB
->
CC_id
);
ru_proc
->
timestamp_tx
=
L1_proc
->
timestamp_tx
;
ru_proc
->
subframe_tx
=
L1_proc
->
subframe_tx
;
ru_proc
->
frame_tx
=
L1_proc
->
frame_tx
;
}
}
...
...
@@ -493,7 +491,7 @@ int wakeup_txfh(eNB_rxtx_proc_t *proc,PHY_VARS_eNB *eNB) {
wait
.
tv_sec
=
0
;
wait
.
tv_nsec
=
5000000L
;
LTE_DL_FRAME_PARMS
*
fp
;
LOG_I
(
PHY
,
"ENTERED wakeup_txfh
\n
"
);
for
(
int
ru_id
=
0
;
ru_id
<
eNB
->
num_RU
;
ru_id
++
){
ru_proc
=
&
eNB
->
RU_list
[
ru_id
]
->
proc
;
fp
=
&
eNB
->
RU_list
[
ru_id
]
->
frame_parms
;
...
...
@@ -501,15 +499,13 @@ LOG_I(PHY,"ENTERED wakeup_txfh\n");
// skip the RUs that are not synced
if
(
eNB
->
RU_list
[
ru_id
]
->
state
==
RU_SYNC
)
{
LOG_D
(
PHY
,
"wakeup_txfh: eNB %d : Skipping ru %d
\n
"
,
eNB
->
Mod_id
,
ru_id
);
continue
;
}
if
(
ru_proc
==
NULL
)
return
(
0
);
LOG_D
(
PHY
,
"Entering wakeup_txfh, ru_proc->cond_eNBs, ru_proc->ru_tx_ready, frame_rx %d, subframe_rx %d, frame_tx %d, subframe_tx %d
\n
"
,
proc
->
frame_rx
,
proc
->
subframe_rx
,
ru_proc
->
frame_tx
,
ru_proc
->
subframe_tx
);
if
(
wait_on_condition
(
&
ru_proc
->
mutex_eNBs
,
&
ru_proc
->
cond_eNBs
,
&
ru_proc
->
ru_tx_ready
,
"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
(
ru_proc
==
NULL
)
{
return
(
0
);}
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
"
,
ru_proc
->
frame_tx
,
ru_proc
->
subframe_tx
);
return
(
-
1
);
}
LOG_D
(
PHY
,
"Passed wakeup_txfh ru_proc->cond_eNBs, frame_rx %d, subframe_rx %d, frame_tx %d, subframe_tx %d
\n
"
,
ru_proc
->
frame_rx
,
ru_proc
->
subframe_rx
,
ru_proc
->
frame_tx
,
ru_proc
->
subframe_tx
);
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
);
return
(
-
1
);
...
...
@@ -520,7 +516,7 @@ LOG_I(PHY,"ENTERED wakeup_txfh\n");
return
(
-
1
);
}
LOG_D
(
PHY
,
"waking up for frame %d subframe %d for RU TX
\n
"
,
proc
->
frame_tx
,
proc
->
subframe_tx
);
++
ru_proc
->
instance_cnt_eNBs
;
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
;
...
...
@@ -531,7 +527,6 @@ LOG_I(PHY,"ENTERED wakeup_txfh\n");
exit_fun
(
"ERROR pthread_cond_signal"
);
return
(
-
1
);
}
LOG_I
(
PHY
,
"Sent wakeup_txfh ru_proc->cond_eNBs to tx_thread
\n
, frame_rx %d, subframe_rx %d, frame_tx %d, subframe_tx %d
\n
"
,
proc
->
frame_rx
,
proc
->
subframe_rx
,
ru_proc
->
frame_tx
,
ru_proc
->
subframe_tx
);
pthread_mutex_unlock
(
&
ru_proc
->
mutex_eNBs
);
}
return
(
0
);
...
...
@@ -540,58 +535,54 @@ LOG_I(PHY,"ENTERED wakeup_txfh\n");
int
wakeup_tx
(
PHY_VARS_eNB
*
eNB
,
RU_proc_t
*
ru_proc
)
{
eNB_proc_t
*
proc
=&
eNB
->
proc
;
eNB_rxtx_proc_t
*
proc_rxtx1
=&
proc
->
proc_rxtx
[
1
];
/**proc_rxtx=&proc->proc_rxtx[proc->frame_rx&1];*/
eNB_rxtx_proc_t
*
proc_rxtx0
=&
proc
->
proc_rxtx
[
0
];
/* LTE_DL_FRAME_PARMS *fp;
fp = &eNB->frame_parms;
if ((fp->frame_type == TDD) && (subframe_select(fp,proc_rxtx0->subframe_tx)==SF_UL)) return;
*/
eNB_rxtx_proc_t
*
L1_proc_tx
=
&
proc
->
L1_proc_tx
;
eNB_rxtx_proc_t
*
L1_proc
=
&
proc
->
L1_proc
;
struct
timespec
wait
;
wait
.
tv_sec
=
0
;
wait
.
tv_nsec
=
5000000L
;
LOG_I
(
PHY
,
"ENTERED wakeup_tx
\n
"
);
if
(
proc_rxtx1
->
instance_cnt_rxtx
==
0
)
{
LOG_E
(
PHY
,
"Frame %d, subframe %d: TX1 thread busy, dropping
\n
"
,
proc_rxtx1
->
frame_rx
,
proc_rxtx1
->
subframe_rx
);
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
);
}
if
(
pthread_mutex_timedlock
(
&
proc_rxtx1
->
mutex_rxtx
,
&
wait
)
!=
0
)
{
LOG_E
(
PHY
,
"[eNB] ERROR pthread_mutex_lock for eNB TX1 thread %d (IC %d)
\n
"
,
proc_rxtx1
->
subframe_rx
&
1
,
proc_rxtx1
->
instance_cnt_rxtx
);
exit_fun
(
"error locking mutex_tx"
);
return
(
-
1
);
while
(
L1_proc_tx
->
instance_cnt
==
0
){
pthread_cond_wait
(
&
L1_proc_tx
->
cond
,
&
L1_proc_tx
->
mutex
);
}
++
proc_rxtx1
->
instance_cnt_rxtx
;
L1_proc_tx
->
instance_cnt
=
0
;
proc_rxtx1
->
subframe_rx
=
proc_rxtx0
->
subframe_rx
;
proc_rxtx1
->
frame_rx
=
proc_rxtx0
->
frame_rx
;
proc_rxtx1
->
subframe_tx
=
proc_rxtx0
->
subframe_tx
;
proc_rxtx1
->
frame_tx
=
proc_rxtx0
->
frame_tx
;
proc_rxtx1
->
timestamp_tx
=
proc_rxtx0
->
timestamp_tx
;
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
(
&
proc_rxtx1
->
cond_rxtx
)
!=
0
)
{
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
);
}
LOG_I
(
PHY
,
"Sent wakeup_tx proc1->cond_rxtx to tx_thread, frame_rx %d, subframe_rx %d, frame_tx %d, subframe_tx %d
\n
"
,
proc_rxtx1
->
frame_rx
,
proc_rxtx1
->
subframe_rx
,
proc_rxtx1
->
frame_tx
,
proc_rxtx1
->
subframe_tx
);
pthread_mutex_unlock
(
&
proc_rxtx1
->
mutex_rxtx
);
pthread_mutex_unlock
(
&
L1_proc_tx
->
mutex
);
return
(
0
);
}
int
wakeup_rxtx
(
PHY_VARS_eNB
*
eNB
,
RU_t
*
ru
)
{
eNB_proc_t
*
proc
=&
eNB
->
proc
;
RU_proc_t
*
ru_proc
=&
ru
->
proc
;
eNB_rxtx_proc_t
*
proc_rxtx0
=&
proc
->
proc_rxtx
[
0
];
//eNB_rxtx_proc_t *proc_rxtx1=&proc->proc_rxtx[1];
LOG_I
(
PHY
,
"ENTERED wakeup_rxtx
\n
"
);
eNB_rxtx_proc_t
*
L1_proc
=&
proc
->
L1_proc
;
LTE_DL_FRAME_PARMS
*
fp
=
&
eNB
->
frame_parms
;
int
i
;
...
...
@@ -600,28 +591,20 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) {
wait
.
tv_sec
=
0
;
wait
.
tv_nsec
=
5000000L
;
LOG_D
(
PHY
,
"Entering wakeup_rxtx, cond_rxtx, proc0->pipe_ready, frame %d, subframe %d
\n
"
,
proc_rxtx0
->
frame_rx
,
proc_rxtx0
->
subframe_rx
);
if
(
wait_on_condition
(
&
proc_rxtx0
->
mutex_rxtx
,
&
proc_rxtx0
->
cond_rxtx
,
&
proc_rxtx0
->
pipe_ready
,
"wakeup_rxtx"
)
<
0
)
{
LOG_E
(
PHY
,
"Frame %d, subframe %d: RXTX0 not ready
\n
"
,
proc_rxtx0
->
frame_rx
,
proc_rxtx0
->
subframe_rx
);
return
(
-
1
);
}
LOG_D
(
PHY
,
"Passed wakeup_rxtx proc0->cond_rxtx, frame %d, subframe %d
\n
"
,
proc_rxtx0
->
frame_rx
,
proc_rxtx0
->
subframe_rx
);
if
(
release_thread
(
&
proc_rxtx0
->
mutex_rxtx
,
&
proc_rxtx0
->
pipe_ready
,
"wakeup_rxtx"
)
<
0
)
return
(
-
1
);
if
(
proc_rxtx0
->
instance_cnt_rxtx
==
0
)
{
LOG_E
(
PHY
,
"Frame %d, subframe %d: RXTX0 thread busy, dropping
\n
"
,
proc_rxtx0
->
frame_rx
,
proc_rxtx0
->
subframe_rx
);
if
(
L1_proc
->
instance_cnt
==
0
)
{
LOG_E
(
PHY
,
"Frame %d, subframe %d: RXTX0 thread busy, dropping
\n
"
,
L1_proc
->
frame_rx
,
L1_proc
->
subframe_rx
);
return
(
-
1
);
}
// wake up TX for subframe n+sf_ahead
// lock the TX mutex and make sure the thread is ready
if
(
pthread_mutex_timedlock
(
&
proc_rxtx0
->
mutex_rxt
x
,
&
wait
)
!=
0
)
{
LOG_E
(
PHY
,
"[eNB] ERROR pthread_mutex_lock for eNB RXTX thread %d (IC %d)
\n
"
,
proc_rxtx0
->
subframe_rx
&
1
,
proc_rxtx0
->
instance_cnt_rxtx
);
if
(
pthread_mutex_timedlock
(
&
L1_proc
->
mute
x
,
&
wait
)
!=
0
)
{
LOG_E
(
PHY
,
"[eNB] ERROR pthread_mutex_lock for eNB RXTX thread %d (IC %d)
\n
"
,
L1_proc
->
subframe_rx
&
1
,
L1_proc
->
instance_cnt
);
exit_fun
(
"error locking mutex_rxtx"
);
return
(
-
1
);
}
++
proc_rxtx0
->
instance_cnt_rxtx
;
++
L1_proc
->
instance_cnt
;
// We have just received and processed the common part of a subframe, say n.
// TS_rx is the last received timestamp (start of 1st slot), TS_tx is the desired
...
...
@@ -629,20 +612,20 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) {
// The last (TS_rx mod samples_per_frame) was n*samples_per_tti,
// we want to generate subframe (n+sf_ahead), so TS_tx = TX_rx+sf_ahead*samples_per_tti,
// and proc->subframe_tx = proc->subframe_rx+sf_ahead
proc_rxtx0
->
timestamp_tx
=
ru_proc
->
timestamp_rx
+
(
sf_ahead
*
fp
->
samples_per_tti
);
proc_rxtx0
->
frame_rx
=
ru_proc
->
frame_rx
;
proc_rxtx0
->
subframe_rx
=
ru_proc
->
subframe_rx
;
proc_rxtx0
->
frame_tx
=
(
proc_rxtx0
->
subframe_rx
>
(
9
-
sf_ahead
))
?
(
proc_rxtx0
->
frame_rx
+
1
)
&
1023
:
proc_rxtx0
->
frame_rx
;
proc_rxtx0
->
subframe_tx
=
(
proc_rxtx0
->
subframe_rx
+
sf_ahead
)
%
10
;
L1_proc
->
timestamp_tx
=
ru_proc
->
timestamp_rx
+
(
sf_ahead
*
fp
->
samples_per_tti
);
L1_proc
->
frame_rx
=
ru_proc
->
frame_rx
;
L1_proc
->
subframe_rx
=
ru_proc
->
subframe_rx
;
L1_proc
->
frame_tx
=
(
L1_proc
->
subframe_rx
>
(
9
-
sf_ahead
))
?
(
L1_proc
->
frame_rx
+
1
)
&
1023
:
L1_proc
->
frame_rx
;
L1_proc
->
subframe_tx
=
(
L1_proc
->
subframe_rx
+
sf_ahead
)
%
10
;
// the thread can now be woken up
if
(
pthread_cond_signal
(
&
proc_rxtx0
->
cond_rxtx
)
!=
0
)
{
if
(
pthread_cond_signal
(
&
L1_proc
->
cond
)
!=
0
)
{
LOG_E
(
PHY
,
"[eNB] ERROR pthread_cond_signal for eNB RXn-TXnp4 thread
\n
"
);
exit_fun
(
"ERROR pthread_cond_signal"
);
return
(
-
1
);
}
LOG_I
(
PHY
,
"Sent wakeup_rxtx proc0->cond_rxtx to eNB_thread_rxtx, frame_rx %d, subframe_rx %d, frame_tx %d, subframe_tx %d
\n
"
,
proc_rxtx0
->
frame_rx
,
proc_rxtx0
->
subframe_rx
,
proc_rxtx0
->
frame_tx
,
proc_rxtx0
->
subframe_tx
);
pthread_mutex_unlock
(
&
proc_rxtx0
->
mutex_rxtx
);
pthread_mutex_unlock
(
&
L1_proc
->
mutex
);
return
(
0
);
}
...
...
@@ -898,7 +881,7 @@ void init_eNB_proc(int inst) {
int
CC_id
;
PHY_VARS_eNB
*
eNB
;
eNB_proc_t
*
proc
;
eNB_rxtx_proc_t
*
proc_rx
tx
;
eNB_rxtx_proc_t
*
L1_proc
,
*
L1_proc_
tx
;
pthread_attr_t
*
attr0
=
NULL
,
*
attr1
=
NULL
,
*
attr_prach
=
NULL
;
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
pthread_attr_t
*
attr_prach_br
=
NULL
;
...
...
@@ -913,26 +896,32 @@ void init_eNB_proc(int inst) {
#endif
proc
=
&
eNB
->
proc
;
proc_rxtx
=
proc
->
proc_rxtx
;
proc_rxtx
[
0
].
instance_cnt_rxtx
=
-
1
;
proc_rxtx
[
1
].
instance_cnt_rxtx
=
-
1
;
proc_rxtx
[
0
].
pipe_ready
=
0
;
proc_rxtx
[
1
].
pipe_ready
=
0
;
L1_proc
=
&
proc
->
L1_proc
;
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
;
proc
->
CC_id
=
CC_id
;
proc
->
first_rx
=
1
;
proc
->
first_tx
=
1
;
for
(
int
i
=
0
;
i
<
10
;
i
++
)
proc
->
RU_mask
[
i
]
=
0
;
proc
->
RU_mask_prach
=
0
;
proc
->
first_rx
=
1
;
proc
->
first_tx
=
1
;
proc
->
RU_mask
=
0
;
//for (int i=0;i<10;i++) proc->RU_mask[i]=0;
proc
->
RU_mask_prach
=
0
;
pthread_mutex_init
(
&
eNB
->
UL_INFO_mutex
,
NULL
);
pthread_mutex_init
(
&
proc_rxtx
[
0
].
mutex_rxtx
,
NULL
);
pthread_mutex_init
(
&
proc_rxtx
[
1
].
mutex_rxtx
,
NULL
);
pthread_cond_init
(
&
proc_rxtx
[
0
].
cond_rxtx
,
NULL
);
pthread_cond_init
(
&
proc_rxtx
[
1
].
cond_rxtx
,
NULL
);
pthread_mutex_init
(
&
L1_proc
->
mutex
,
NULL
);
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
);
...
...
@@ -944,8 +933,8 @@ void init_eNB_proc(int inst) {
pthread_attr_init
(
&
proc
->
attr_prach
);
pthread_attr_init
(
&
proc
->
attr_asynch_rxtx
);
pthread_attr_init
(
&
proc_rxtx
[
0
].
attr_rxtx
);
pthread_attr_init
(
&
proc_rxtx
[
1
].
attr_rxtx
);
pthread_attr_init
(
&
L1_proc
->
attr
);
pthread_attr_init
(
&
L1_proc_tx
->
attr
);
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
proc
->
instance_cnt_prach_br
=
-
1
;
proc
->
RU_mask_prach_br
=
0
;
...
...
@@ -955,8 +944,8 @@ void init_eNB_proc(int inst) {
pthread_attr_init
(
&
proc
->
attr_prach_br
);
#endif
#ifndef DEADLINE_SCHEDULER
attr0
=
&
proc_rxtx
[
0
].
attr_rxtx
;
attr1
=
&
proc_rxtx
[
1
].
attr_rxtx
;
attr0
=
&
L1_proc
->
attr
;
attr1
=
&
L1_proc_tx
->
attr
;
attr_prach
=
&
proc
->
attr_prach
;
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
attr_prach_br
=
&
proc
->
attr_prach_br
;
...
...
@@ -978,20 +967,13 @@ void init_eNB_proc(int inst) {
proc_rxtx
[
0
].
instance_cnt_rxtx
,
proc_rxtx
[
1
].
instance_cnt_rxtx
);
if
((
get_thread_parallel_conf
()
==
PARALLEL_RU_L1_SPLIT
||
get_thread_parallel_conf
()
==
PARALLEL_RU_L1_TRX_SPLIT
)
&&
nfapi_mode
!=
2
)
{
pthread_create
(
&
proc_rxtx
[
0
].
pthread_rxtx
,
attr0
,
eNB_thread_rxtx
,
eNB
);
pthread_create
(
&
proc_rxtx
[
1
].
pthread_rxtx
,
attr1
,
tx_thread
,
eNB
);
pthread_create
(
&
L1_proc
->
pthread
,
attr0
,
L1_thread
,
proc
);
//!!!!!!!!!!!!!!!!!!!!! for us it is eNB !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
pthread_create
(
&
L1_proc_tx
->
pthread
,
attr1
,
L1_thread_tx
,
proc
);
}
pthread_create
(
&
proc
->
pthread_prach
,
attr_prach
,
eNB_thread_prach
,
eNB
);
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
pthread_create
(
&
proc
->
pthread_prach_br
,
attr_prach_br
,
eNB_thread_prach_br
,
eNB
);
#endif
/*char name[16];
if (eNB->single_thread_flag==0) {
snprintf( name, sizeof(name), "RXTX0 %d", i );
pthread_setname_np( proc_rxtx[0].pthread_rxtx, name );
snprintf( name, sizeof(name), "RXTX1 %d", i );
pthread_setname_np( proc_rxtx[1].pthread_rxtx, name );
}*/
AssertFatal
(
proc
->
instance_cnt_prach
==
-
1
,
"instance_cnt_prach = %d
\n
"
,
proc
->
instance_cnt_prach
);
...
...
@@ -1036,27 +1018,30 @@ void kill_eNB_proc(int inst) {
int
*
status
;
PHY_VARS_eNB
*
eNB
;
eNB_proc_t
*
proc
;
eNB_rxtx_proc_t
*
proc_rx
tx
;
int
i
;
eNB_rxtx_proc_t
*
L1_proc
,
*
L1_proc_
tx
;
for
(
int
CC_id
=
0
;
CC_id
<
MAX_NUM_CCs
;
CC_id
++
)
{
eNB
=
RC
.
eNB
[
inst
][
CC_id
];
proc
=
&
eNB
->
proc
;
proc_rxtx
=
&
proc
->
proc_rxtx
[
0
];
proc
=
&
eNB
->
proc
;
L1_proc
=
&
proc
->
L1_proc
;
L1_proc_tx
=
&
proc
->
L1_proc_tx
;
if
(
get_thread_worker_conf
()
==
WORKER_ENABLE
)
{
kill_td_thread
(
eNB
);
kill_te_thread
(
eNB
);
}
LOG_I
(
PHY
,
"Killing TX CC_id %d inst %d
\n
"
,
CC_id
,
inst
);
for
(
i
=
0
;
i
<
2
;
i
++
)
{
pthread_mutex_lock
(
&
proc_rxtx
[
i
].
mutex_rxtx
);
proc_rxtx
[
i
].
instance_cnt_rxtx
=
0
;
proc_rxtx
[
i
].
pipe_ready
=
0
;
pthread_cond_signal
(
&
proc_rxtx
[
i
].
cond_rxtx
);
pthread_mutex_unlock
(
&
proc_rxtx
[
i
].
mutex_rxtx
);
}
pthread_mutex_lock
(
&
L1_proc
->
mutex
);
L1_proc
->
instance_cnt
=
0
;
pthread_cond_signal
(
&
L1_proc
->
cond
);
pthread_mutex_unlock
(
&
L1_proc
->
mutex
);
pthread_mutex_lock
(
&
L1_proc_tx
->
mutex
);
L1_proc_tx
->
instance_cnt
=
0
;
pthread_cond_signal
(
&
L1_proc_tx
->
cond
);
pthread_mutex_unlock
(
&
L1_proc_tx
->
mutex
);
pthread_mutex_lock
(
&
proc
->
mutex_prach
);
proc
->
instance_cnt_prach
=
0
;
pthread_cond_signal
(
&
proc
->
cond_prach
);
...
...
@@ -1080,18 +1065,24 @@ void kill_eNB_proc(int inst) {
#endif
LOG_I
(
PHY
,
"Destroying UL_INFO mutex
\n
"
);
pthread_mutex_destroy
(
&
eNB
->
UL_INFO_mutex
);
for
(
i
=
0
;
i
<
2
;
i
++
)
{
LOG_I
(
PHY
,
"Joining rxtx[%d] mutex/cond
\n
"
,
i
);
pthread_join
(
proc_rxtx
[
i
].
pthread_rxtx
,
(
void
**
)
&
status
);
LOG_I
(
PHY
,
"Destroying rxtx[%d] mutex/cond
\n
"
,
i
);
pthread_mutex_destroy
(
&
proc_rxtx
[
i
].
mutex_rxtx
);
pthread_
cond_destroy
(
&
proc_rxtx
[
i
].
cond_rxtx
);
if
((
get_thread_parallel_conf
()
==
PARALLEL_RU_L1_SPLIT
||
get_thread_parallel_conf
()
==
PARALLEL_RU_L1_TRX_SPLIT
)
&&
nfapi_mode
!=
2
)
{
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
"
);
pthread_
join
(
L1_proc_tx
->
pthread
,
(
void
**
)
&
status
);
}
LOG_I
(
PHY
,
"Destroying L1_proc mutex/cond
\n
"
);
pthread_mutex_destroy
(
&
L1_proc
->
mutex
);
pthread_cond_destroy
(
&
L1_proc
->
cond
);
LOG_I
(
PHY
,
"Destroying L1_proc_tx mutex/cond
\n
"
);
pthread_mutex_destroy
(
&
L1_proc_tx
->
mutex
);
pthread_cond_destroy
(
&
L1_proc_tx
->
cond
);
pthread_attr_destroy
(
&
proc
->
attr_prach
);
pthread_attr_destroy
(
&
proc
->
attr_asynch_rxtx
);
pthread_attr_destroy
(
&
proc_rxtx
[
0
].
attr_rxtx
);
pthread_attr_destroy
(
&
proc_rxtx
[
1
].
attr_rxtx
);
pthread_attr_destroy
(
&
L1_proc
->
attr
);
pthread_attr_destroy
(
&
L1_proc_tx
->
attr
);
#ifdef Rel14
pthread_mutex_destroy
(
&
proc
->
mutex_RU_PRACH_br
);
pthread_attr_destroy
(
&
proc
->
attr_prach_br
);
...
...
targets/RT/USER/lte-ru.c
View file @
bc2ee097
...
...
@@ -1135,7 +1135,7 @@ int check_sync(RU_t *ru, RU_t *ru_master, int subframe){
return
1
;
}
void
wakeup_
eNB
s
(
RU_t
*
ru
)
{
void
wakeup_
L1
s
(
RU_t
*
ru
)
{
int
i
;
PHY_VARS_eNB
**
eNB_list
=
ru
->
eNB_list
;
...
...
@@ -1146,6 +1146,12 @@ void wakeup_eNBs(RU_t *ru) {
LOG_I
(
PHY
,
"ENTERED wakeup_eNBs
\n
"
);
LOG_D
(
PHY
,
"wakeup_eNBs (num %d) for RU %d (state %s)ru->eNB_top:%p
\n
"
,
ru
->
num_eNB
,
ru
->
idx
,
ru_states
[
ru
->
state
],
ru
->
eNB_top
);
LOG_D
(
PHY
,
"wakeup_L1s (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
)
{
// call eNB function directly
char
string
[
20
];
sprintf
(
string
,
"Incoming RU %d"
,
ru
->
idx
);
...
...
@@ -1482,8 +1488,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
);
...
...
@@ -1506,11 +1516,10 @@ static void* ru_thread_tx( void* param ) {
LOG_D
(
PHY
,
"ru_thread_tx (ru %d): Waiting for TX processing
\n
"
,
ru
->
idx
);
// wait until eNBs are finished subframe RX n and TX n+4
//printf("ru_thread_tx, ru_proc->cond_eNBs, ru_proc->instance_cnt_eNBs\n");
wait_on_condition
(
&
proc
->
mutex_eNBs
,
&
proc
->
cond_eNBs
,
&
proc
->
instance_cnt_eNBs
,
"ru_thread_tx"
);
//printf("Passed ru_thread_tx ru_proc->cond_eNBs\n");
LOG_I
(
PHY
,
"ru_thread_tx (ru %d): Woken from condition
\n
"
,
ru
->
idx
);
if
(
oai_exit
)
break
;
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
);
...
...
@@ -1525,16 +1534,22 @@ if (oai_exit) break;
}
release_thread
(
&
proc
->
mutex_eNBs
,
&
proc
->
instance_cnt_eNBs
,
"ru_thread_tx"
);
pthread_mutex_lock
(
&
proc
->
mutex_eNBs
);
proc
->
ru_tx_ready
++
;
//printf("~~~~~~~~~~~~~~~~~~proc->ru_tx_ready = %d\n", 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
);
}
//printf("Sent ru_thread_tx, ru_proc->cond_eNBs to tx_thread\n");
pthread_mutex_unlock
(
&
proc
->
mutex_eNBs
);
}
release_thread
(
&
proc
->
mutex_FH1
,
&
proc
->
instance_cnt_FH1
,
"ru_thread_tx"
);
return
0
;
...
...
@@ -1797,10 +1812,10 @@ static void* ru_thread( void* param ) {
exit_fun
(
"error unlocking mutex_pre_scd"
);
}
#endif
// wakeup all eNB processes waiting for this RU
if
(
ru
->
num_eNB
>
0
)
wakeup_eNB
s
(
ru
);
// wakeup all eNB processes waiting for this 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
){
// do TX front-end processing if needed (precoding and/or IDFTs)
...
...
@@ -1976,7 +1991,7 @@ static void* eNB_thread_phy_tx( void* param ) {
RU_proc_t
*
proc
=
&
ru
->
proc
;
PHY_VARS_eNB
**
eNB_list
=
ru
->
eNB_list
;
eNB_rxtx_proc_t
proc_rxtx
;
eNB_rxtx_proc_t
L1_proc
;
// set default return value
eNB_thread_phy_tx_status
=
0
;
...
...
@@ -1993,9 +2008,9 @@ static void* eNB_thread_phy_tx( void* param ) {
LOG_D
(
PHY
,
"Running eNB phy tx procedures
\n
"
);
if
(
ru
->
num_eNB
==
1
){
proc_rxtx
.
subframe_tx
=
proc
->
subframe_phy_tx
;
proc_rxtx
.
frame_tx
=
proc
->
frame_phy_tx
;
phy_procedures_eNB_TX
(
eNB_list
[
0
],
&
proc_rxtx
,
1
);
L1_proc
.
subframe_tx
=
proc
->
subframe_phy_tx
;
L1_proc
.
frame_tx
=
proc
->
frame_phy_tx
;
phy_procedures_eNB_TX
(
eNB_list
[
0
],
&
L1_proc
,
1
);
phy_tx_txdataF_end
=
1
;
if
(
pthread_mutex_lock
(
&
ru
->
proc
.
mutex_rf_tx
)
!=
0
){
LOG_E
(
PHY
,
"[RU] ERROR pthread_mutex_lock for rf tx thread (IC %d)
\n
"
,
ru
->
proc
.
instance_cnt_rf_tx
);
...
...
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