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
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
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
OpenXG-RAN
Commits
20a2e83c
Commit
20a2e83c
authored
Oct 22, 2018
by
Y_Tomita
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add multiple UE's L2 FAPI simulator's function.
parent
eb0ebc58
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
227 additions
and
96 deletions
+227
-96
openair2/LAYER2/MAC/mac_extern.h
openair2/LAYER2/MAC/mac_extern.h
+1
-0
openair2/LAYER2/MAC/main_ue.c
openair2/LAYER2/MAC/main_ue.c
+8
-1
openair2/LAYER2/MAC/ue_procedures.c
openair2/LAYER2/MAC/ue_procedures.c
+28
-24
openair2/PHY_INTERFACE/phy_stub_UE.c
openair2/PHY_INTERFACE/phy_stub_UE.c
+51
-18
targets/RT/USER/lte-ue.c
targets/RT/USER/lte-ue.c
+139
-53
No files found.
openair2/LAYER2/MAC/mac_extern.h
View file @
20a2e83c
...
...
@@ -65,6 +65,7 @@ extern unsigned char NB_INST;
#endif
extern
unsigned
char
NB_eNB_INST
;
extern
uint16_t
NB_UE_INST
;
extern
uint16_t
NB_THREAD_INST
;
extern
unsigned
char
NB_RN_INST
;
extern
unsigned
short
NODE_ID
[
1
];
...
...
openair2/LAYER2/MAC/main_ue.c
100644 → 100755
View file @
20a2e83c
...
...
@@ -43,7 +43,7 @@
#include "common/ran_context.h"
extern
FILL_UL_INFO_MUTEX_t
fill_ul_mutex
;
extern
void
openair_rrc_top_init_ue
(
int
eMBMS_active
,
char
*
uecap_xer
,
uint8_t
cba_group_active
,
uint8_t
HO_active
);
void
dl_phy_sync_success
(
module_id_t
module_idP
,
frame_t
frameP
,
unsigned
char
eNB_index
,
uint8_t
first_sync
)
//init as MR
...
...
@@ -103,6 +103,13 @@ mac_top_init_ue(int eMBMS_active, char *uecap_xer,
UE_mac_inst
=
NULL
;
}
// mutex below are used for multiple UE's L2 FAPI simulation.
pthread_mutex_init
(
&
fill_ul_mutex
.
rx_mutex
,
NULL
);
pthread_mutex_init
(
&
fill_ul_mutex
.
crc_mutex
,
NULL
);
pthread_mutex_init
(
&
fill_ul_mutex
.
sr_mutex
,
NULL
);
pthread_mutex_init
(
&
fill_ul_mutex
.
harq_mutex
,
NULL
);
pthread_mutex_init
(
&
fill_ul_mutex
.
cqi_mutex
,
NULL
);
pthread_mutex_init
(
&
fill_ul_mutex
.
rach_mutex
,
NULL
);
LOG_I
(
MAC
,
"[MAIN] calling RRC
\n
"
);
openair_rrc_top_init_ue
(
eMBMS_active
,
uecap_xer
,
cba_group_active
,
...
...
openair2/LAYER2/MAC/ue_procedures.c
100644 → 100755
View file @
20a2e83c
...
...
@@ -70,6 +70,8 @@ extern uint8_t usim_test;
extern
UL_IND_t
*
UL_INFO
;
extern
uint8_t
nfapi_mode
;
extern
int
next_ra_frame
;
extern
module_id_t
next_Mod_id
;
/*
*
...
...
@@ -2524,7 +2526,7 @@ ue_scheduler(const module_id_t module_idP,
UE_mac_inst
[
module_idP
].
crnti
,
txFrameP
,
txSubframeP
,
eNB_indexP
);
#if defined(ENABLE_ITTI)
if
(
module_idP
==
0
){
do
{
// Checks if a message has been sent to MAC sub-task
itti_poll_msg
(
TASK_MAC_UE
,
&
msg_p
);
...
...
@@ -2554,14 +2556,16 @@ ue_scheduler(const module_id_t module_idP,
}
}
while
(
msg_p
!=
NULL
);
}
#endif
//Mac_rlc_xface->frameP=frameP;
//Rrc_xface->Frame_index=Mac_rlc_xface->frameP;
//if (subframe%5 == 0)
//LG#ifdef EXMIMO
if
(
module_idP
==
0
){
pdcp_run
(
&
ctxt
);
}
//#endif
UE_mac_inst
[
module_idP
].
txFrame
=
txFrameP
;
UE_mac_inst
[
module_idP
].
txSubframe
=
txSubframeP
;
...
...
openair2/PHY_INTERFACE/phy_stub_UE.c
View file @
20a2e83c
...
...
@@ -51,7 +51,9 @@ void fill_rx_indication_UE_MAC(module_id_t Mod_id,int frame,int subframe, UL_IND
int
timing_advance_update
;
pthread_mutex_lock
(
&
UE_mac_inst
[
Mod_id
].
UL_INFO_mutex
);
// pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
// change for mutiple UE's simulation.
pthread_mutex_lock
(
&
fill_ul_mutex
.
rx_mutex
);
UL_INFO
->
rx_ind
.
sfn_sf
=
frame
<<
4
|
subframe
;
...
...
@@ -88,7 +90,9 @@ void fill_rx_indication_UE_MAC(module_id_t Mod_id,int frame,int subframe, UL_IND
UL_INFO
->
rx_ind
.
rx_indication_body
.
number_of_pdus
++
;
UL_INFO
->
rx_ind
.
sfn_sf
=
frame
<<
4
|
subframe
;
pthread_mutex_unlock
(
&
UE_mac_inst
[
Mod_id
].
UL_INFO_mutex
);
// pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
// change for mutiple UE's simulation.
pthread_mutex_unlock
(
&
fill_ul_mutex
.
rx_mutex
);
}
...
...
@@ -96,7 +100,9 @@ void fill_rx_indication_UE_MAC(module_id_t Mod_id,int frame,int subframe, UL_IND
void
fill_sr_indication_UE_MAC
(
int
Mod_id
,
int
frame
,
int
subframe
,
UL_IND_t
*
UL_INFO
,
uint16_t
rnti
)
{
pthread_mutex_lock
(
&
UE_mac_inst
[
Mod_id
].
UL_INFO_mutex
);
// change for mutiple UE's simulation.
//pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
pthread_mutex_lock
(
&
fill_ul_mutex
.
sr_mutex
);
nfapi_sr_indication_t
*
sr_ind
=
&
UL_INFO
->
sr_ind
;
nfapi_sr_indication_body_t
*
sr_ind_body
=
&
sr_ind
->
sr_indication_body
;
...
...
@@ -130,13 +136,17 @@ void fill_sr_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_I
//UL_INFO->rx_ind.rx_indication_body.number_of_pdus++;
sr_ind_body
->
number_of_srs
++
;
pthread_mutex_unlock
(
&
UE_mac_inst
[
Mod_id
].
UL_INFO_mutex
);
// change for mutiple UE's simulation.
// pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
pthread_mutex_unlock
(
&
fill_ul_mutex
.
sr_mutex
);
}
void
fill_crc_indication_UE_MAC
(
int
Mod_id
,
int
frame
,
int
subframe
,
UL_IND_t
*
UL_INFO
,
uint8_t
crc_flag
,
int
index
,
uint16_t
rnti
)
{
pthread_mutex_lock
(
&
UE_mac_inst
[
Mod_id
].
UL_INFO_mutex
);
// change for mutiple UE's simulation.
//pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
pthread_mutex_lock
(
&
fill_ul_mutex
.
crc_mutex
);
// REMEMBER HAVE EXCHANGED THE FOLLOWING TWO LINES HERE!
nfapi_crc_indication_pdu_t
*
pdu
=
&
UL_INFO
->
crc_ind
.
crc_indication_body
.
crc_pdu_list
[
UL_INFO
->
crc_ind
.
crc_indication_body
.
number_of_crcs
];
...
...
@@ -159,14 +169,21 @@ void fill_crc_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_
LOG_D
(
PHY
,
"%s() rnti:%04x pdus:%d
\n
"
,
__FUNCTION__
,
pdu
->
rx_ue_information
.
rnti
,
UL_INFO
->
crc_ind
.
crc_indication_body
.
number_of_crcs
);
pthread_mutex_unlock
(
&
UE_mac_inst
[
Mod_id
].
UL_INFO_mutex
);
// change for mutiple UE's simulation.
// pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
pthread_mutex_unlock
(
&
fill_ul_mutex
.
crc_mutex
);
}
void
fill_rach_indication_UE_MAC
(
int
Mod_id
,
int
frame
,
int
subframe
,
UL_IND_t
*
UL_INFO
,
uint8_t
ra_PreambleIndex
,
uint16_t
ra_RNTI
)
{
LOG_D
(
MAC
,
"fill_rach_indication_UE_MAC 1
\n
"
);
pthread_mutex_lock
(
&
UE_mac_inst
[
Mod_id
].
UL_INFO_mutex
);
UL_INFO
=
(
UL_IND_t
*
)
malloc
(
sizeof
(
UL_IND_t
));
// change for mutiple UE's simulation.
// pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
pthread_mutex_lock
(
&
fill_ul_mutex
.
rach_mutex
);
// memory allocation and free memory of UL_INFO are done in UE_phy_stub_single_thread_rxn_txnp4.
// UL_INFO = (UL_IND_t*)malloc(sizeof(UL_IND_t));
UL_INFO
->
rach_ind
.
rach_indication_body
.
number_of_preambles
=
1
;
...
...
@@ -203,16 +220,22 @@ void fill_rach_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL
// with that branch.
oai_nfapi_rach_ind
(
&
UL_INFO
->
rach_ind
);
free
(
UL_INFO
->
rach_ind
.
rach_indication_body
.
preamble_list
);
free
(
UL_INFO
);
// memory allocation and free memory of UL_INFO are done in UE_phy_stub_single_thread_rxn_txnp4.
//free(UL_INFO);
//}
pthread_mutex_unlock
(
&
UE_mac_inst
[
Mod_id
].
UL_INFO_mutex
);
// change for mutiple UE's simulation.
// pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
pthread_mutex_unlock
(
&
fill_ul_mutex
.
rach_mutex
);
}
void
fill_ulsch_cqi_indication_UE_MAC
(
int
Mod_id
,
uint16_t
frame
,
uint8_t
subframe
,
UL_IND_t
*
UL_INFO
,
uint16_t
rnti
)
{
pthread_mutex_lock
(
&
UE_mac_inst
[
Mod_id
].
UL_INFO_mutex
);
// change for mutiple UE's simulation.
//pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
pthread_mutex_lock
(
&
fill_ul_mutex
.
cqi_mutex
);
nfapi_cqi_indication_pdu_t
*
pdu
=
&
UL_INFO
->
cqi_ind
.
cqi_pdu_list
[
UL_INFO
->
cqi_ind
.
number_of_cqis
];
nfapi_cqi_indication_raw_pdu_t
*
raw_pdu
=
&
UL_INFO
->
cqi_ind
.
cqi_raw_pdu_list
[
UL_INFO
->
cqi_ind
.
number_of_cqis
];
...
...
@@ -241,14 +264,18 @@ void fill_ulsch_cqi_indication_UE_MAC(int Mod_id, uint16_t frame,uint8_t subfram
UL_INFO
->
cqi_ind
.
number_of_cqis
++
;
pthread_mutex_unlock
(
&
UE_mac_inst
[
Mod_id
].
UL_INFO_mutex
);
// change for mutiple UE's simulation.
//pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
pthread_mutex_unlock
(
&
fill_ul_mutex
.
cqi_mutex
);
}
void
fill_ulsch_harq_indication_UE_MAC
(
int
Mod_id
,
int
frame
,
int
subframe
,
UL_IND_t
*
UL_INFO
,
nfapi_ul_config_ulsch_harq_information
*
harq_information
,
uint16_t
rnti
)
{
pthread_mutex_lock
(
&
UE_mac_inst
[
Mod_id
].
UL_INFO_mutex
);
// change for mutiple UE's simulation.
//pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
pthread_mutex_lock
(
&
fill_ul_mutex
.
harq_mutex
);
nfapi_harq_indication_pdu_t
*
pdu
=
&
UL_INFO
->
harq_ind
.
harq_indication_body
.
harq_pdu_list
[
UL_INFO
->
harq_ind
.
harq_indication_body
.
number_of_harqs
];
int
i
;
...
...
@@ -279,8 +306,9 @@ void fill_ulsch_harq_indication_UE_MAC(int Mod_id, int frame,int subframe, UL_IN
}
UL_INFO
->
harq_ind
.
harq_indication_body
.
number_of_harqs
++
;
pthread_mutex_unlock
(
&
UE_mac_inst
[
Mod_id
].
UL_INFO_mutex
);
}
// change for mutiple UE's simulation.
//pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
pthread_mutex_unlock
(
&
fill_ul_mutex
.
harq_mutex
);}
void
fill_uci_harq_indication_UE_MAC
(
int
Mod_id
,
...
...
@@ -293,7 +321,10 @@ void fill_uci_harq_indication_UE_MAC(int Mod_id,
uint16_t tdd_multiplexing_mask*/
)
{
pthread_mutex_lock
(
&
UE_mac_inst
[
Mod_id
].
UL_INFO_mutex
);
// change for mutiple UE's simulation.
//pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
pthread_mutex_lock
(
&
fill_ul_mutex
.
harq_mutex
);
nfapi_harq_indication_t
*
ind
=
&
UL_INFO
->
harq_ind
;
nfapi_harq_indication_body_t
*
body
=
&
ind
->
harq_indication_body
;
nfapi_harq_indication_pdu_t
*
pdu
=
&
body
->
harq_pdu_list
[
UL_INFO
->
harq_ind
.
harq_indication_body
.
number_of_harqs
];
...
...
@@ -363,7 +394,9 @@ void fill_uci_harq_indication_UE_MAC(int Mod_id,
UL_INFO
->
harq_ind
.
harq_indication_body
.
number_of_harqs
++
;
LOG_D
(
PHY
,
"Incremented eNB->UL_INFO.harq_ind.number_of_harqs:%d
\n
"
,
UL_INFO
->
harq_ind
.
harq_indication_body
.
number_of_harqs
);
pthread_mutex_unlock
(
&
UE_mac_inst
[
Mod_id
].
UL_INFO_mutex
);
// change for mutiple UE's simulation.
//pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
pthread_mutex_unlock
(
&
fill_ul_mutex
.
harq_mutex
);
}
...
...
targets/RT/USER/lte-ue.c
View file @
20a2e83c
...
...
@@ -102,9 +102,11 @@ void ue_stub_rx_handler(unsigned int, char *);
int32_t
**
rxdata
;
int32_t
**
txdata
;
int
timer_subframe
;
int
timer_frame
;
SF_ticking
*
phy_stub_ticking
;
int
timer_subframe
=
0
;
int
timer_frame
=
0
;
SF_ticking
*
phy_stub_ticking
=
NULL
;
int
next_ra_frame
=
0
;
module_id_t
next_Mod_id
=
0
;
#define KHz (1000UL)
#define MHz (1000*KHz)
...
...
@@ -954,31 +956,53 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
thread_top_init
(
"UE_phy_stub_thread_rxn_txnp4"
,
1
,
870000L
,
1000000L
,
1000000L
);
module_id_t
Mod_id
=
0
;
// for multipule UE's L2-emulator
//module_id_t Mod_id = 0;
//int init_ra_UE = -1; // This counter is used to initiate the RA of each UE in different SFrames
static
__thread
int
UE_thread_rxtx_retval
;
struct
rx_tx_thread_data
*
rtd
=
arg
;
UE_rxtx_proc_t
*
proc
=
rtd
->
proc
;
// settings for nfapi-L2-emulator mode
module_id_t
ue_thread_id
=
rtd
->
ue_thread_id
;
uint16_t
ue_index
=
0
;
uint16_t
ue_num
=
NB_UE_INST
/
NB_THREAD_INST
+
((
NB_UE_INST
%
NB_THREAD_INST
>
ue_thread_id
)
?
1
:
0
);
module_id_t
ue_Mod_id
;
PHY_VARS_UE
*
UE
;
//= rtd->UE;
int
ret
;
uint8_t
end_flag
;
proc
=
&
PHY_vars_UE_g
[
0
][
0
]
->
proc
.
proc_rxtx
[
0
];
phy_stub_ticking
->
num_single_thread
[
ue_thread_id
]
=
-
1
;
if
(
ue_thread_id
==
0
){
phy_stub_ticking
->
ticking_var
=
-
1
;
proc
->
subframe_rx
=
proc
->
sub_frame_start
;
// Initializations for nfapi-L2-emulator mode
dl_config_req
=
NULL
;
ul_config_req
=
NULL
;
hi_dci0_req
=
NULL
;
tx_request_pdu_list
=
NULL
;
PHY_VARS_UE
*
UE
;
//= rtd->UE;
int
ret
;
// waiting for all UE's threads set phy_stub_ticking->num_single_thread[ue_thread_id] = -1.
do
{
end_flag
=
1
;
for
(
uint16_t
i
=
0
;
i
<
NB_THREAD_INST
;
i
++
){
if
(
phy_stub_ticking
->
num_single_thread
[
i
]
==
0
){
end_flag
=
0
;
}
}
}
while
(
end_flag
==
0
);
phy_stub_ticking
->
ticking_var
=
-
1
;
proc
->
subframe_rx
=
proc
->
sub_frame_start
;
sync_var
=
0
;
}
//PANOS: CAREFUL HERE!
wait_sync
(
"UE_phy_stub_single_thread_rxn_txnp4"
);
while
(
!
oai_exit
)
{
if
(
ue_thread_id
==
0
){
if
(
pthread_mutex_lock
(
&
phy_stub_ticking
->
mutex_ticking
)
!=
0
)
{
LOG_E
(
MAC
,
"[SCHED][UE] error locking mutex for UE RXTX
\n
"
);
exit_fun
(
"nothing to add"
);
...
...
@@ -1025,15 +1049,47 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
UL_INFO
->
harq_ind
.
harq_indication_body
.
harq_pdu_list
=
(
nfapi_harq_indication_pdu_t
*
)
malloc
(
NB_UE_INST
*
sizeof
(
nfapi_harq_indication_pdu_t
));
UL_INFO
->
harq_ind
.
harq_indication_body
.
number_of_harqs
=
0
;
UL_INFO
->
sr_ind
.
sr_indication_body
.
sr_pdu_list
=
(
nfapi_sr_indication_pdu_t
*
)
malloc
(
NB_UE_INST
*
sizeof
(
nfapi_sr_indication_pdu_t
));
UL_INFO
->
sr_ind
.
sr_indication_body
.
sr_pdu_list
=
(
nfapi_sr_indication_pdu_t
*
)
malloc
(
NB_UE_INST
*
sizeof
(
nfapi_sr_indication_pdu_t
));
UL_INFO
->
sr_ind
.
sr_indication_body
.
number_of_srs
=
0
;
UL_INFO
->
cqi_ind
.
cqi_pdu_list
=
(
nfapi_cqi_indication_pdu_t
*
)
malloc
(
NB_UE_INST
*
sizeof
(
nfapi_cqi_indication_pdu_t
));
UL_INFO
->
cqi_ind
.
cqi_raw_pdu_list
=
(
nfapi_cqi_indication_raw_pdu_t
*
)
malloc
(
NB_UE_INST
*
sizeof
(
nfapi_cqi_indication_raw_pdu_t
));
UL_INFO
->
cqi_ind
.
number_of_cqis
=
0
;
if
(
pthread_mutex_lock
(
&
phy_stub_ticking
->
mutex_single_thread
)
!=
0
)
{
LOG_E
(
MAC
,
"[SCHED][UE] error locking mutex for ue_thread_id %d (mutex_single_thread)
\n
"
,
ue_thread_id
);
exit_fun
(
"nothing to add"
);
}
memset
(
&
phy_stub_ticking
->
num_single_thread
[
0
],
0
,
sizeof
(
int
)
*
NB_THREAD_INST
);
pthread_cond_broadcast
(
&
phy_stub_ticking
->
cond_single_thread
);
if
(
pthread_mutex_unlock
(
&
phy_stub_ticking
->
mutex_single_thread
)
!=
0
)
{
LOG_E
(
MAC
,
"[SCHED][UE] error unlocking mutex for ue_thread_id %d (mutex_single_thread)
\n
"
,
ue_thread_id
);
exit_fun
(
"nothing to add"
);
}
}
else
{
if
(
pthread_mutex_lock
(
&
phy_stub_ticking
->
mutex_single_thread
)
!=
0
)
{
LOG_E
(
MAC
,
"[SCHED][UE] error locking mutex for ue_thread_id %d (mutex_single_thread)
\n
"
,
ue_thread_id
);
exit_fun
(
"nothing to add"
);
}
while
(
phy_stub_ticking
->
num_single_thread
[
ue_thread_id
]
<
0
)
{
// most of the time, the thread is waiting here
LOG_D
(
MAC
,
"Waiting for single_thread (ue_thread_id %d)
\n
"
,
ue_thread_id
);
pthread_cond_wait
(
&
phy_stub_ticking
->
cond_single_thread
,
&
phy_stub_ticking
->
mutex_single_thread
);
}
if
(
pthread_mutex_unlock
(
&
phy_stub_ticking
->
mutex_single_thread
)
!=
0
)
{
LOG_E
(
MAC
,
"[SCHED][UE] error unlocking mutex for ue_thread_id %d (mutex_single_thread)
\n
"
,
ue_thread_id
);
exit_fun
(
"nothing to add"
);
}
}
for
(
Mod_id
=
0
;
Mod_id
<
NB_UE_INST
;
Mod_id
++
)
{
//for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++) {
for
(
ue_index
=
0
;
ue_index
<
ue_num
;
ue_index
++
)
{
ue_Mod_id
=
ue_thread_id
+
NB_THREAD_INST
*
ue_index
;
UE
=
PHY_vars_UE_g
[
ue_Mod_id
][
0
];
//LOG_D(MAC, "UE_phy_stub_single_thread_rxn_txnp4, NB_UE_INST:%d, Mod_id:%d \n", NB_UE_INST, Mod_id);
UE
=
PHY_vars_UE_g
[
Mod_id
][
0
];
//
UE = PHY_vars_UE_g[Mod_id][0];
lte_subframe_t
sf_type
=
subframe_select
(
&
UE
->
frame_parms
,
proc
->
subframe_rx
);
if
((
sf_type
==
SF_DL
)
||
(
UE
->
frame_parms
.
frame_type
==
FDD
)
||
...
...
@@ -1059,12 +1115,12 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
if
(
dl_config_req
!=
NULL
&&
tx_request_pdu_list
!=
NULL
){
//if(dl_config_req!= NULL) {
dl_config_req_UE_MAC
(
dl_config_req
,
Mod_id
);
dl_config_req_UE_MAC
(
dl_config_req
,
ue_
Mod_id
);
}
if
(
hi_dci0_req
!=
NULL
&&
hi_dci0_req
->
hi_dci0_request_body
.
hi_dci0_pdu_list
!=
NULL
){
hi_dci0_req_UE_MAC
(
hi_dci0_req
,
Mod_id
);
hi_dci0_req_UE_MAC
(
hi_dci0_req
,
ue_
Mod_id
);
}
if
(
nfapi_mode
!=
3
)
...
...
@@ -1078,7 +1134,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
if
(
UE
->
mac_enabled
==
1
)
{
ret
=
ue_scheduler
(
UE
->
Mod_id
,
ret
=
ue_scheduler
(
ue_
Mod_id
,
proc
->
frame_rx
,
proc
->
subframe_rx
,
proc
->
frame_tx
,
...
...
@@ -1104,34 +1160,37 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
// We make the start of RA between consecutive UEs differ by 20 frames
//if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && proc->frame_rx >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) {
if
(
UE_mac_inst
[
Mod_id
].
UE_mode
[
0
]
==
PRACH
&&
Mod_id
==
next_Mod_id
&&
proc
->
frame_rx
>=
next_ra_frame
)
{
if
(
UE_mac_inst
[
ue_Mod_id
].
UE_mode
[
0
]
==
PRACH
&&
ue_Mod_id
==
next_Mod_id
)
{
next_ra_frame
++
;
if
(
next_ra_frame
>
200
){
// check if we have PRACH opportunity
if
(
is_prach_subframe
(
&
UE
->
frame_parms
,
proc
->
frame_tx
,
proc
->
subframe_tx
)
&&
UE_mac_inst
[
Mod_id
].
SI_Decoded
==
1
)
{
if
(
is_prach_subframe
(
&
UE
->
frame_parms
,
proc
->
frame_tx
,
proc
->
subframe_tx
)
&&
UE_mac_inst
[
ue_
Mod_id
].
SI_Decoded
==
1
)
{
// The one working strangely...
//if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx && Mod_id == (module_id_t) init_ra_UE) ) {
PRACH_RESOURCES_t
*
prach_resources
=
ue_get_rach
(
Mod_id
,
0
,
proc
->
frame_tx
,
0
,
proc
->
subframe_tx
);
PRACH_RESOURCES_t
*
prach_resources
=
ue_get_rach
(
ue_
Mod_id
,
0
,
proc
->
frame_tx
,
0
,
proc
->
subframe_tx
);
if
(
prach_resources
!=
NULL
)
{
UE_mac_inst
[
Mod_id
].
ra_frame
=
proc
->
frame_rx
;
LOG_D
(
MAC
,
"UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d
\n
"
,
Mod_id
);
fill_rach_indication_UE_MAC
(
Mod_id
,
proc
->
frame_tx
,
proc
->
subframe_tx
,
UL_INFO
,
prach_resources
->
ra_PreambleIndex
,
prach_resources
->
ra_RNTI
);
Msg1_transmitted
(
Mod_id
,
0
,
proc
->
frame_tx
,
0
);
UE_mac_inst
[
Mod_id
].
UE_mode
[
0
]
=
RA_RESPONSE
;
next_Mod_id
=
Mod_id
+
1
;
next_ra_frame
=
(
proc
->
frame_rx
+
20
)
%
1000
;
UE_mac_inst
[
ue_Mod_id
].
ra_frame
=
proc
->
frame_rx
;
LOG_D
(
MAC
,
"UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d
\n
"
,
ue_Mod_id
,
proc
->
frame_tx
,
proc
->
subframe_tx
);
fill_rach_indication_UE_MAC
(
ue_Mod_id
,
proc
->
frame_tx
,
proc
->
subframe_tx
,
UL_INFO
,
prach_resources
->
ra_PreambleIndex
,
prach_resources
->
ra_RNTI
);
Msg1_transmitted
(
ue_Mod_id
,
0
,
proc
->
frame_tx
,
0
);
UE_mac_inst
[
ue_Mod_id
].
UE_mode
[
0
]
=
RA_RESPONSE
;
next_Mod_id
=
ue_Mod_id
+
1
;
//next_ra_frame = (proc->frame_rx + 20)%1000;
next_ra_frame
=
0
;
}
//ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode);
}
}
}
// mode is PRACH
// Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger
// UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB).
// Generate UL_indications which correspond to UL traffic.
if
(
ul_config_req
!=
NULL
){
//&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){
ul_config_req_UE_MAC
(
ul_config_req
,
timer_frame
,
timer_subframe
,
Mod_id
);
ul_config_req_UE_MAC
(
ul_config_req
,
timer_frame
,
timer_subframe
,
ue_
Mod_id
);
}
}
...
...
@@ -1140,6 +1199,19 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
}
//for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++)
phy_stub_ticking
->
num_single_thread
[
ue_thread_id
]
=
-
1
;
// waiting for all UE's threads set phy_stub_ticking->num_single_thread[ue_thread_id] = -1.
if
(
ue_thread_id
==
0
){
do
{
end_flag
=
1
;
for
(
uint16_t
i
=
0
;
i
<
NB_THREAD_INST
;
i
++
){
if
(
phy_stub_ticking
->
num_single_thread
[
i
]
==
0
){
end_flag
=
0
;
}
}
}
while
(
end_flag
==
0
);
if
(
UL_INFO
->
crc_ind
.
crc_indication_body
.
number_of_crcs
>
0
)
{
...
...
@@ -1154,6 +1226,9 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
//LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/SF:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf));
//LOG_I(MAC, "ul_config_req_UE_MAC 2.3, SFN/SF of PNF counter:%d.%d, number_of_pdus: %d \n", timer_frame, timer_subframe, UL_INFO->rx_ind.rx_indication_body.number_of_pdus);
oai_nfapi_rx_ind
(
&
UL_INFO
->
rx_ind
);
for
(
uint8_t
num_pdu
=
0
;
num_pdu
<
UL_INFO
->
rx_ind
.
rx_indication_body
.
number_of_pdus
;
num_pdu
++
){
free
(
UL_INFO
->
rx_ind
.
rx_indication_body
.
rx_pdu_list
[
num_pdu
].
data
);
}
//LOG_I(MAC, "ul_config_req_UE_MAC 2.31 \n");
UL_INFO
->
rx_ind
.
rx_indication_body
.
number_of_pdus
=
0
;
}
...
...
@@ -1190,14 +1265,19 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
free
(
UL_INFO
->
sr_ind
.
sr_indication_body
.
sr_pdu_list
);
UL_INFO
->
sr_ind
.
sr_indication_body
.
sr_pdu_list
=
NULL
;
//}
free
(
UL_INFO
->
cqi_ind
.
cqi_pdu_list
);
UL_INFO
->
cqi_ind
.
cqi_pdu_list
=
NULL
;
free
(
UL_INFO
->
cqi_ind
.
cqi_raw_pdu_list
);
UL_INFO
->
cqi_ind
.
cqi_raw_pdu_list
=
NULL
;
free
(
UL_INFO
);
UL_INFO
=
NULL
;
// De-allocate memory of nfapi requests copies before next subframe round
if
(
dl_config_req
!=
NULL
){
if
(
dl_config_req
->
vendor_extension
)
if
(
dl_config_req
->
vendor_extension
!=
NULL
){
free
(
dl_config_req
->
vendor_extension
);
dl_config_req
->
vendor_extension
=
NULL
;
}
if
(
dl_config_req
->
dl_config_request_body
.
dl_config_pdu_list
!=
NULL
){
free
(
dl_config_req
->
dl_config_request_body
.
dl_config_pdu_list
);
dl_config_req
->
dl_config_request_body
.
dl_config_pdu_list
=
NULL
;
...
...
@@ -1227,7 +1307,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
hi_dci0_req
=
NULL
;
}
}
}
// thread finished
...
...
@@ -1792,11 +1872,14 @@ void init_UE_single_thread_stub(int nb_inst) {
// In phy_stub_UE mode due to less heavy processing operations we don't need two threads
//int nb_threads=RX_NB_TH;
int
nb_threads
=
1
;
for
(
uint16_t
ue_thread_id
=
0
;
ue_thread_id
<
NB_THREAD_INST
;
ue_thread_id
++
){
UE
=
PHY_vars_UE_g
[
ue_thread_id
][
0
];
for
(
int
i
=
0
;
i
<
nb_threads
;
i
++
)
{
rtd
=
calloc
(
1
,
sizeof
(
struct
rx_tx_thread_data
));
if
(
rtd
==
NULL
)
abort
();
rtd
->
UE
=
UE
;
rtd
->
proc
=
&
UE
->
proc
.
proc_rxtx
[
i
];
rtd
->
ue_thread_id
=
ue_thread_id
;
pthread_mutex_init
(
&
UE
->
proc
.
proc_rxtx
[
i
].
mutex_rxtx
,
NULL
);
pthread_cond_init
(
&
UE
->
proc
.
proc_rxtx
[
i
].
cond_rxtx
,
NULL
);
...
...
@@ -1804,7 +1887,7 @@ void init_UE_single_thread_stub(int nb_inst) {
UE
->
proc
.
proc_rxtx
[
i
].
sub_frame_step
=
nb_threads
;
printf
(
"Init_UE_threads rtd %d proc %d nb_threads %d i %d
\n
"
,
rtd
->
proc
->
sub_frame_start
,
UE
->
proc
.
proc_rxtx
[
i
].
sub_frame_start
,
nb_threads
,
i
);
pthread_create
(
&
UE
->
proc
.
proc_rxtx
[
i
].
pthread_rxtx
,
NULL
,
UE_phy_stub_single_thread_rxn_txnp4
,
rtd
);
}
}
// Remove thread for UE_sync in phy_stub_UE mode.
//pthread_create(&UE->proc.pthread_synch,NULL,UE_thread_synch,(void*)UE);
...
...
@@ -2074,8 +2157,11 @@ int init_timer_thread(void) {
pthread_mutex_init
(
&
UE
->
timer_mutex
,
NULL
);
pthread_cond_init
(
&
UE
->
timer_cond
,
NULL
);
UE
->
instance_cnt_timer
=
-
1
;
memset
(
&
phy_stub_ticking
->
num_single_thread
[
0
],
0
,
sizeof
(
int
)
*
NB_THREAD_INST
);
pthread_mutex_init
(
&
phy_stub_ticking
->
mutex_ticking
,
NULL
);
pthread_cond_init
(
&
phy_stub_ticking
->
cond_ticking
,
NULL
);
pthread_mutex_init
(
&
phy_stub_ticking
->
mutex_single_thread
,
NULL
);
pthread_cond_init
(
&
phy_stub_ticking
->
cond_single_thread
,
NULL
);
pthread_create
(
&
phy_stub_ticking
->
pthread_timer
,
NULL
,
&
timer_thread
,
NULL
);
return
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