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
zzha zzha
OpenXG-RAN
Commits
13122a27
Commit
13122a27
authored
Oct 31, 2019
by
laurent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ul in parallel monolithic case, ul in parallel memory leak fix
parent
f0759d6e
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
267 additions
and
464 deletions
+267
-464
common/utils/threadPool/thread-pool.c
common/utils/threadPool/thread-pool.c
+4
-3
common/utils/threadPool/thread-pool.h
common/utils/threadPool/thread-pool.h
+28
-11
executables/main-fs6.c
executables/main-fs6.c
+1
-1
executables/main-ocp.c
executables/main-ocp.c
+5
-4
openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
+1
-0
openair1/PHY/LTE_TRANSPORT/transport_eNB.h
openair1/PHY/LTE_TRANSPORT/transport_eNB.h
+1
-0
openair1/PHY/LTE_TRANSPORT/transport_proto.h
openair1/PHY/LTE_TRANSPORT/transport_proto.h
+2
-0
openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c
openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c
+130
-202
openair1/PHY/defs_eNB.h
openair1/PHY/defs_eNB.h
+4
-5
openair1/SCHED/phy_procedures_lte_eNb.c
openair1/SCHED/phy_procedures_lte_eNb.c
+91
-238
No files found.
common/utils/threadPool/thread-pool.c
View file @
13122a27
...
@@ -84,7 +84,7 @@ void *one_thread(void *arg) {
...
@@ -84,7 +84,7 @@ void *one_thread(void *arg) {
delNotifiedFIFO_elt
(
elt
);
delNotifiedFIFO_elt
(
elt
);
else
else
pushNotifiedFIFO
(
elt
->
reponseFifo
,
elt
);
pushNotifiedFIFO
(
elt
->
reponseFifo
,
elt
);
myThread
->
runningOnKey
=-
1
;
mutexunlock
(
tp
->
incomingFifo
.
lockF
);
mutexunlock
(
tp
->
incomingFifo
.
lockF
);
}
}
}
while
(
true
);
}
while
(
true
);
...
@@ -116,7 +116,7 @@ void initTpool(char *params,tpool_t *pool, bool performanceMeas) {
...
@@ -116,7 +116,7 @@ void initTpool(char *params,tpool_t *pool, bool performanceMeas) {
pool
->
nbThreads
=
0
;
pool
->
nbThreads
=
0
;
pool
->
restrictRNTI
=
false
;
pool
->
restrictRNTI
=
false
;
curptr
=
strtok_r
(
params
,
","
,
&
saveptr
);
curptr
=
strtok_r
(
params
,
","
,
&
saveptr
);
struct
one_thread
*
ptr
;
while
(
curptr
!=
NULL
)
{
while
(
curptr
!=
NULL
)
{
int
c
=
toupper
(
curptr
[
0
]);
int
c
=
toupper
(
curptr
[
0
]);
...
@@ -130,8 +130,9 @@ void initTpool(char *params,tpool_t *pool, bool performanceMeas) {
...
@@ -130,8 +130,9 @@ void initTpool(char *params,tpool_t *pool, bool performanceMeas) {
break
;
break
;
default:
default:
ptr
=
pool
->
allthreads
;
pool
->
allthreads
=
(
struct
one_thread
*
)
malloc
(
sizeof
(
struct
one_thread
));
pool
->
allthreads
=
(
struct
one_thread
*
)
malloc
(
sizeof
(
struct
one_thread
));
pool
->
allthreads
->
next
=
p
ool
->
allthreads
;
pool
->
allthreads
->
next
=
p
tr
;
printf
(
"create a thread for core %d
\n
"
,
atoi
(
curptr
));
printf
(
"create a thread for core %d
\n
"
,
atoi
(
curptr
));
pool
->
allthreads
->
coreID
=
atoi
(
curptr
);
pool
->
allthreads
->
coreID
=
atoi
(
curptr
);
pool
->
allthreads
->
id
=
pool
->
nbThreads
;
pool
->
allthreads
->
id
=
pool
->
nbThreads
;
...
...
common/utils/threadPool/thread-pool.h
View file @
13122a27
...
@@ -137,8 +137,9 @@ static inline notifiedFIFO_elt_t *pollNotifiedFIFO(notifiedFIFO_t *nf) {
...
@@ -137,8 +137,9 @@ static inline notifiedFIFO_elt_t *pollNotifiedFIFO(notifiedFIFO_t *nf) {
// This function aborts all messages matching the key
// This function aborts all messages matching the key
// If the queue is used in thread pools, it doesn't cancels already running processing
// If the queue is used in thread pools, it doesn't cancels already running processing
// because the message has already been picked
// because the message has already been picked
static
inline
void
abortNotifiedFIFO
(
notifiedFIFO_t
*
nf
,
uint64_t
key
)
{
static
inline
int
abortNotifiedFIFO
(
notifiedFIFO_t
*
nf
,
uint64_t
key
)
{
mutexlock
(
nf
->
lockF
);
mutexlock
(
nf
->
lockF
);
int
nbDeleted
=
0
;
notifiedFIFO_elt_t
**
start
=&
nf
->
outF
;
notifiedFIFO_elt_t
**
start
=&
nf
->
outF
;
while
(
*
start
!=
NULL
)
{
while
(
*
start
!=
NULL
)
{
...
@@ -146,13 +147,15 @@ static inline void abortNotifiedFIFO(notifiedFIFO_t *nf, uint64_t key) {
...
@@ -146,13 +147,15 @@ static inline void abortNotifiedFIFO(notifiedFIFO_t *nf, uint64_t key) {
notifiedFIFO_elt_t
*
request
=*
start
;
notifiedFIFO_elt_t
*
request
=*
start
;
*
start
=
(
*
start
)
->
next
;
*
start
=
(
*
start
)
->
next
;
delNotifiedFIFO_elt
(
request
);
delNotifiedFIFO_elt
(
request
);
}
nbDeleted
++
;
}
else
if
(
*
start
!=
NULL
)
start
=&
(
*
start
)
->
next
;
start
=&
(
*
start
)
->
next
;
}
}
if
(
nf
->
outF
==
NULL
)
nf
->
inF
=
NULL
;
mutexunlock
(
nf
->
lockF
);
mutexunlock
(
nf
->
lockF
);
return
nbDeleted
;
}
}
struct
one_thread
{
struct
one_thread
{
...
@@ -181,8 +184,17 @@ typedef struct thread_pool {
...
@@ -181,8 +184,17 @@ typedef struct thread_pool {
static
inline
void
pushTpool
(
tpool_t
*
t
,
notifiedFIFO_elt_t
*
msg
)
{
static
inline
void
pushTpool
(
tpool_t
*
t
,
notifiedFIFO_elt_t
*
msg
)
{
if
(
t
->
measurePerf
)
msg
->
creationTime
=
rdtsc
();
if
(
t
->
measurePerf
)
msg
->
creationTime
=
rdtsc
();
if
(
t
->
activated
)
pushNotifiedFIFO
(
&
t
->
incomingFifo
,
msg
);
pushNotifiedFIFO
(
&
t
->
incomingFifo
,
msg
);
else
{
if
(
t
->
measurePerf
)
msg
->
startProcessingTime
=
rdtsc
();
msg
->
processingFunc
(
NotifiedFifoData
(
msg
));
if
(
t
->
measurePerf
)
msg
->
endProcessingTime
=
rdtsc
();
if
(
msg
->
reponseFifo
)
pushNotifiedFIFO
(
msg
->
reponseFifo
,
msg
);
}
}
}
static
inline
notifiedFIFO_elt_t
*
pullTpool
(
notifiedFIFO_t
*
responseFifo
,
tpool_t
*
t
)
{
static
inline
notifiedFIFO_elt_t
*
pullTpool
(
notifiedFIFO_t
*
responseFifo
,
tpool_t
*
t
)
{
...
@@ -212,7 +224,8 @@ static inline notifiedFIFO_elt_t *tryPullTpool(notifiedFIFO_t *responseFifo, tpo
...
@@ -212,7 +224,8 @@ static inline notifiedFIFO_elt_t *tryPullTpool(notifiedFIFO_t *responseFifo, tpo
return
msg
;
return
msg
;
}
}
static
inline
void
abortTpool
(
tpool_t
*
t
,
uint64_t
key
)
{
static
inline
int
abortTpool
(
tpool_t
*
t
,
uint64_t
key
)
{
int
nbRemoved
=
0
;
notifiedFIFO_t
*
nf
=&
t
->
incomingFifo
;
notifiedFIFO_t
*
nf
=&
t
->
incomingFifo
;
mutexlock
(
nf
->
lockF
);
mutexlock
(
nf
->
lockF
);
notifiedFIFO_elt_t
**
start
=&
nf
->
outF
;
notifiedFIFO_elt_t
**
start
=&
nf
->
outF
;
...
@@ -222,22 +235,26 @@ static inline void abortTpool(tpool_t *t, uint64_t key) {
...
@@ -222,22 +235,26 @@ static inline void abortTpool(tpool_t *t, uint64_t key) {
notifiedFIFO_elt_t
*
request
=*
start
;
notifiedFIFO_elt_t
*
request
=*
start
;
*
start
=
(
*
start
)
->
next
;
*
start
=
(
*
start
)
->
next
;
delNotifiedFIFO_elt
(
request
);
delNotifiedFIFO_elt
(
request
);
}
nbRemoved
++
;
}
else
if
(
*
start
!=
NULL
)
start
=&
(
*
start
)
->
next
;
start
=&
(
*
start
)
->
next
;
}
}
if
(
t
->
incomingFifo
.
outF
==
NULL
)
t
->
incomingFifo
.
inF
=
NULL
;
struct
one_thread
*
ptr
=
t
->
allthreads
;
struct
one_thread
*
ptr
=
t
->
allthreads
;
while
(
ptr
!=
NULL
)
{
while
(
ptr
!=
NULL
)
{
if
(
ptr
->
runningOnKey
==
key
)
if
(
ptr
->
runningOnKey
==
key
)
{
ptr
->
abortFlag
=
true
;
ptr
->
abortFlag
=
true
;
nbRemoved
++
;
}
ptr
=
ptr
->
next
;
ptr
=
ptr
->
next
;
}
}
mutexunlock
(
nf
->
lockF
);
mutexunlock
(
nf
->
lockF
);
return
nbRemoved
;
}
}
void
initTpool
(
char
*
params
,
tpool_t
*
pool
,
bool
performanceMeas
);
void
initTpool
(
char
*
params
,
tpool_t
*
pool
,
bool
performanceMeas
);
...
...
executables/main-fs6.c
View file @
13122a27
...
@@ -615,7 +615,7 @@ void pusch_procedures_fromsplit(uint8_t *bufferZone, int bufSize, PHY_VARS_eNB *
...
@@ -615,7 +615,7 @@ void pusch_procedures_fromsplit(uint8_t *bufferZone, int bufSize, PHY_VARS_eNB *
&
ulsch_harq
->
Kplus
,
&
ulsch_harq
->
Kplus
,
&
ulsch_harq
->
Kminus
,
&
ulsch_harq
->
Kminus
,
&
ulsch_harq
->
F
);
&
ulsch_harq
->
F
);
int
ret
=
ulsch_decoding_data
(
eNB
,
i
,
harq_pid
,
int
ret
=
ulsch_decoding_data
(
eNB
,
proc
,
i
,
harq_pid
,
ulsch_harq
->
nb_rb
>
20
?
1
:
0
);
ulsch_harq
->
nb_rb
>
20
?
1
:
0
);
stop_meas
(
&
eNB
->
ulsch_decoding_stats
);
stop_meas
(
&
eNB
->
ulsch_decoding_stats
);
LOG_D
(
PHY
,
LOG_D
(
PHY
,
...
...
executables/main-ocp.c
View file @
13122a27
...
@@ -692,13 +692,14 @@ static void *ru_thread( void *param ) {
...
@@ -692,13 +692,14 @@ static void *ru_thread( void *param ) {
L1_rxtx_proc_t
L1proc
;
L1_rxtx_proc_t
L1proc
;
L1_rxtx_proc_t
*
proc
=&
L1proc
;
L1_rxtx_proc_t
*
proc
=&
L1proc
;
if
(
strlen
(
get_softmodem_params
()
->
threadPoolConfig
)
>
0
)
{
if
(
strlen
(
get_softmodem_params
()
->
threadPoolConfig
)
>
0
)
initTpool
(
get_softmodem_params
()
->
threadPoolConfig
,
&
L1proc
.
threadPool
,
true
);
initTpool
(
get_softmodem_params
()
->
threadPoolConfig
,
&
L1proc
.
threadPool
,
true
);
initNotifiedFIFO
(
&
L1proc
.
respEncode
);
else
initNotifiedFIFO
(
&
L1proc
.
respDecode
);
}
else
initTpool
(
"n"
,
&
L1proc
.
threadPool
,
true
);
initTpool
(
"n"
,
&
L1proc
.
threadPool
,
true
);
initNotifiedFIFO
(
&
L1proc
.
respEncode
);
initNotifiedFIFO
(
&
L1proc
.
respDecode
);
if
(
ru
->
if_south
==
LOCAL_RF
)
{
// configure RF parameters only
if
(
ru
->
if_south
==
LOCAL_RF
)
{
// configure RF parameters only
fill_rf_config
(
ru
,
ru
->
rf_config_file
);
fill_rf_config
(
ru
,
ru
->
rf_config_file
);
init_frame_parms
(
&
ru
->
frame_parms
,
1
);
init_frame_parms
(
&
ru
->
frame_parms
,
1
);
...
...
openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
View file @
13122a27
...
@@ -398,6 +398,7 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
...
@@ -398,6 +398,7 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
proc
->
nbEncode
++
;
proc
->
nbEncode
++
;
}
else
{
}
else
{
TPencode
(
rdata
);
TPencode
(
rdata
);
delNotifiedFIFO_elt
(
req
);
}
}
int
Qm
=
hadlsch
->
Qm
;
int
Qm
=
hadlsch
->
Qm
;
...
...
openair1/PHY/LTE_TRANSPORT/transport_eNB.h
View file @
13122a27
...
@@ -288,6 +288,7 @@ typedef struct {
...
@@ -288,6 +288,7 @@ typedef struct {
uint8_t
rvidx
;
uint8_t
rvidx
;
/// soft bits for each received segment ("w"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
/// soft bits for each received segment ("w"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
int16_t
w
[
MAX_NUM_ULSCH_SEGMENTS
][
3
*
(
6144
+
64
)];
int16_t
w
[
MAX_NUM_ULSCH_SEGMENTS
][
3
*
(
6144
+
64
)];
int16_t
pusch_rep_buffer
[
MAX_NUM_ULSCH_SEGMENTS
][
3
*
(
6144
+
64
)];
/// soft bits for each received segment ("d"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
/// soft bits for each received segment ("d"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
//TBD
//TBD
int16_t
*
d
[
MAX_NUM_ULSCH_SEGMENTS
];
int16_t
*
d
[
MAX_NUM_ULSCH_SEGMENTS
];
...
...
openair1/PHY/LTE_TRANSPORT/transport_proto.h
View file @
13122a27
...
@@ -469,6 +469,7 @@ void rx_ulsch(PHY_VARS_eNB *eNB,
...
@@ -469,6 +469,7 @@ void rx_ulsch(PHY_VARS_eNB *eNB,
int
ulsch_decoding_data_all
(
PHY_VARS_eNB
*
eNB
,
int
ulsch_decoding_data_all
(
PHY_VARS_eNB
*
eNB
,
L1_rxtx_proc_t
*
proc
,
int
UE_id
,
int
UE_id
,
int
harq_pid
,
int
harq_pid
,
int
llr8_flag
);
int
llr8_flag
);
...
@@ -513,6 +514,7 @@ int ulsch_decoding_data_2thread(PHY_VARS_eNB *eNB,
...
@@ -513,6 +514,7 @@ int ulsch_decoding_data_2thread(PHY_VARS_eNB *eNB,
@returns 0 on success
@returns 0 on success
*/
*/
int
ulsch_decoding_data
(
PHY_VARS_eNB
*
eNB
,
int
ulsch_decoding_data
(
PHY_VARS_eNB
*
eNB
,
L1_rxtx_proc_t
*
proc
,
int
UE_id
,
int
UE_id
,
int
harq_pid
,
int
harq_pid
,
int
llr8_flag
);
int
llr8_flag
);
...
...
openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c
View file @
13122a27
...
@@ -213,42 +213,104 @@ uint8_t extract_cqi_crc(uint8_t *cqi,uint8_t CQI_LENGTH) {
...
@@ -213,42 +213,104 @@ uint8_t extract_cqi_crc(uint8_t *cqi,uint8_t CQI_LENGTH) {
extern
int
oai_exit
;
extern
int
oai_exit
;
int
ulsch_decoding_data
(
PHY_VARS_eNB
*
eNB
,
int
UE_id
,
int
harq_pid
,
int
llr8_flag
)
{
void
processULSegment
(
void
*
arg
)
{
unsigned
int
r
,
r_offset
=
0
,
Kr
,
Kr_bytes
;
turboDecode_t
*
rdata
=
(
turboDecode_t
*
)
arg
;
uint8_t
crc_type
;
PHY_VARS_eNB
*
eNB
=
rdata
->
eNB
;
int
offset
=
0
;
LTE_UL_eNB_HARQ_t
*
ulsch_harq
=
rdata
->
ulsch_harq
;
int
ret
=
1
;
int
r
=
rdata
->
segment_r
;
int16_t
dummy_w
[
MAX_NUM_ULSCH_SEGMENTS
][
3
*
(
6144
+
64
)];
int
G
=
ulsch_harq
->
G
;
LTE_eNB_ULSCH_t
*
ulsch
=
eNB
->
ulsch
[
UE_id
];
int
Kr_bytes
=
rdata
->
Kr
>>
3
;
LTE_UL_eNB_HARQ_t
*
ulsch_harq
=
ulsch
->
harq_processes
[
harq_pid
];
int16_t
dummy_w
[
3
*
(
6144
+
64
)];
int
G
=
ulsch_harq
->
G
;
memset
(
&
dummy_w
[
0
],
0
,
3
*
(
6144
+
64
)
*
sizeof
(
short
));
ulsch_harq
->
RTC
[
r
]
=
generate_dummy_w
(
4
+
(
Kr_bytes
*
8
),
(
uint8_t
*
)
&
dummy_w
[
0
],
(
r
==
0
)
?
ulsch_harq
->
F
:
0
);
start_meas
(
&
eNB
->
ulsch_deinterleaving_stats
);
unsigned
int
E
;
unsigned
int
E
;
decoder_if_t
*
tc
;
if
(
lte_rate_matching_turbo_rx
(
ulsch_harq
->
RTC
[
r
],
static
int32_t
pusch_rep_buffer
[
3
*
(
6144
+
64
)];
G
,
int
max_Ncb
;
ulsch_harq
->
w
[
r
],
(
uint8_t
*
)
&
dummy_w
[
0
],
if
(
llr8_flag
==
0
)
ulsch_harq
->
e
+
rdata
->
r_offset
,
tc
=
*
decoder16
;
ulsch_harq
->
C
,
else
NSOFT
,
tc
=
*
decoder8
;
0
,
//Uplink
1
,
ulsch_harq
->
rvidx
,
(
ulsch_harq
->
rvidx
==
0
)
?
1
:
0
,
// clear
ulsch_harq
->
Qm
,
1
,
r
,
&
E
)
==-
1
)
{
LOG_E
(
PHY
,
"ulsch_decoding.c: Problem in rate matching
\n
"
);
return
;
}
stop_meas
(
&
eNB
->
ulsch_rate_unmatching_stats
);
int
max_Ncb
=
3
*
ulsch_harq
->
RTC
[
r
]
*
32
;
if
(
ulsch_harq
->
repetition_number
==
1
)
{
if
(
ulsch_harq
->
repetition_number
==
1
)
{
memset
(
pusch_rep_buffer
,
0
,(
sizeof
(
int32_t
)
*
3
*
(
6144
+
64
)))
;
// reset the buffer every new repetitions
memset
(
ulsch_harq
->
pusch_rep_buffer
[
r
]
,
0
,(
sizeof
(
int32_t
)
*
3
*
(
6144
+
64
)))
;
// reset the buffer every new repetitions
}
}
if
(
ulsch_harq
->
total_number_of_repetitions
>
1
)
{
if
(
ulsch_harq
->
rvidx
==
1
)
{
LOG_E
(
PHY
,
"Adding HARQ data for segment: %d
\n
"
,
r
);
// Store the result of HARQ combining in the last emtc repetitions of sequence 0,2,3,1
for
(
int
nn
=
0
;
nn
<
max_Ncb
;
nn
++
)
ulsch_harq
->
pusch_rep_buffer
[
r
][
nn
]
+=
ulsch_harq
->
w
[
r
][
nn
]
;
}
for
(
r
=
0
;
r
<
ulsch_harq
->
C
;
r
++
)
{
if
(
ulsch_harq
->
repetition_number
==
ulsch_harq
->
total_number_of_repetitions
)
{
LOG_E
(
PHY
,
"Will use HARQ data sum up for segment: %d
\n
"
,
r
);
for
(
int
nn
=
0
;
nn
<
max_Ncb
;
nn
++
)
ulsch_harq
->
w
[
r
][
nn
]
=
ulsch_harq
->
pusch_rep_buffer
[
r
][
nn
]
;
}
}
int16_t
soft_bits
[
3
*
8
*
6144
+
12
+
96
]
__attribute__
((
aligned
(
32
)));
sub_block_deinterleaving_turbo
(
4
+
rdata
->
Kr
,
soft_bits
+
96
,
ulsch_harq
->
w
[
r
]);
stop_meas
(
&
eNB
->
ulsch_deinterleaving_stats
);
rdata
->
decodeIterations
=
rdata
->
function
(
soft_bits
+
96
,
NULL
,
rdata
->
decoded_bytes
,
NULL
,
rdata
->
Kr
,
rdata
->
maxIterations
,
rdata
->
nbSegments
==
1
?
CRC24_A
:
CRC24_B
,
rdata
->
Fbits
,
&
eNB
->
ulsch_tc_init_stats
,
&
eNB
->
ulsch_tc_alpha_stats
,
&
eNB
->
ulsch_tc_beta_stats
,
&
eNB
->
ulsch_tc_gamma_stats
,
&
eNB
->
ulsch_tc_ext_stats
,
&
eNB
->
ulsch_tc_intl1_stats
,
&
eNB
->
ulsch_tc_intl2_stats
);
stop_meas
(
&
eNB
->
ulsch_turbo_decoding_stats
);
}
int
ulsch_decoding_data
(
PHY_VARS_eNB
*
eNB
,
L1_rxtx_proc_t
*
proc
,
int
UE_id
,
int
harq_pid
,
int
llr8_flag
)
{
unsigned
int
r_offset
=
0
;
int
offset
=
0
;
LTE_eNB_ULSCH_t
*
ulsch
=
eNB
->
ulsch
[
UE_id
];
LTE_UL_eNB_HARQ_t
*
ulsch_harq
=
ulsch
->
harq_processes
[
harq_pid
];
int
G
=
ulsch_harq
->
G
;
unsigned
int
E
;
int
ret
=
0
;
decoder_if_t
*
td
=
llr8_flag
==
0
?
*
decoder16
:
*
decoder8
;
ulsch_harq
->
processedSegments
=
0
;
for
(
int
r
=
0
;
r
<
ulsch_harq
->
C
;
r
++
)
{
// printf("before subblock deinterleaving c[%d] = %p\n",r,ulsch_harq->c[r]);
// printf("before subblock deinterleaving c[%d] = %p\n",r,ulsch_harq->c[r]);
// Get Turbo interleaver parameters
// Get Turbo interleaver parameters
if
(
r
<
ulsch_harq
->
Cminus
)
unsigned
int
Kr
=
r
<
ulsch_harq
->
Cminus
?
Kr
=
ulsch_harq
->
Kminus
;
ulsch_harq
->
Kminus
:
ulsch_harq
->
Kplus
;
else
unsigned
int
Kr_bytes
=
Kr
>>
3
;
Kr
=
ulsch_harq
->
Kplus
;
Kr_bytes
=
Kr
>>
3
;
memset
(
&
dummy_w
[
r
][
0
],
0
,
3
*
(
6144
+
64
)
*
sizeof
(
short
));
ulsch_harq
->
RTC
[
r
]
=
generate_dummy_w
(
4
+
(
Kr_bytes
*
8
),
(
uint8_t
*
)
&
dummy_w
[
r
][
0
],
(
r
==
0
)
?
ulsch_harq
->
F
:
0
);
#ifdef DEBUG_ULSCH_DECODING
#ifdef DEBUG_ULSCH_DECODING
printf
(
"Rate Matching Segment %u (coded bits (G) %d,unpunctured/repeated bits %u, Q_m %d, Nl %d, r_offset %d)...
\n
"
,
printf
(
"Rate Matching Segment %u (coded bits (G) %d,unpunctured/repeated bits %u, Q_m %d, Nl %d, r_offset %d)...
\n
"
,
r
,
G
,
r
,
G
,
...
@@ -256,191 +318,57 @@ int ulsch_decoding_data(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_flag)
...
@@ -256,191 +318,57 @@ int ulsch_decoding_data(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_flag)
ulsch_harq
->
Qm
,
ulsch_harq
->
Qm
,
ulsch_harq
->
Nl
,
r_offset
);
ulsch_harq
->
Nl
,
r_offset
);
#endif
#endif
start_meas
(
&
eNB
->
ulsch_rate_unmatching_stats
);
int
Gp
=
G
/
ulsch_harq
->
Qm
;
#ifdef FS6
int
GpmodC
=
Gp
%
ulsch_harq
->
C
;
if
(
r
<
(
ulsch_harq
->
C
-
(
GpmodC
)))
E
=
ulsch_harq
->
Qm
*
(
Gp
/
ulsch_harq
->
C
);
else
E
=
ulsch_harq
->
Qm
*
((
GpmodC
==
0
?
0
:
1
)
+
(
Gp
/
ulsch_harq
->
C
));
#ifdef FS6
if
(
getenv
(
"fs6"
)
!=
NULL
&&
strncasecmp
(
getenv
(
"fs6"
),
"du"
,
2
)
==
0
)
{
if
(
getenv
(
"fs6"
)
!=
NULL
&&
strncasecmp
(
getenv
(
"fs6"
),
"du"
,
2
)
==
0
)
{
int
Gp
=
G
/
ulsch_harq
->
Qm
;
int
GpmodC
=
Gp
%
ulsch_harq
->
C
;
if
(
r
<
(
ulsch_harq
->
C
-
(
GpmodC
)))
E
=
ulsch_harq
->
Qm
*
(
Gp
/
ulsch_harq
->
C
);
else
E
=
ulsch_harq
->
Qm
*
((
GpmodC
==
0
?
0
:
1
)
+
(
Gp
/
ulsch_harq
->
C
));
sendFs6Ul
(
eNB
,
UE_id
,
harq_pid
,
r
,
ulsch_harq
->
e
+
r_offset
,
E
*
sizeof
(
int16_t
),
r_offset
);
sendFs6Ul
(
eNB
,
UE_id
,
harq_pid
,
r
,
ulsch_harq
->
e
+
r_offset
,
E
*
sizeof
(
int16_t
),
r_offset
);
r_offset
+=
E
;
r_offset
+=
E
;
continue
;
continue
;
}
}
#endif
#endif
if
(
lte_rate_matching_turbo_rx
(
ulsch_harq
->
RTC
[
r
],
G
,
ulsch_harq
->
w
[
r
],
(
uint8_t
*
)
&
dummy_w
[
r
][
0
],
ulsch_harq
->
e
+
r_offset
,
ulsch_harq
->
C
,
NSOFT
,
0
,
//Uplink
1
,
ulsch_harq
->
rvidx
,
(
ulsch_harq
->
rvidx
==
0
)
?
1
:
0
,
// clear
ulsch_harq
->
Qm
,
1
,
r
,
&
E
)
==-
1
)
{
LOG_E
(
PHY
,
"ulsch_decoding.c: Problem in rate matching
\n
"
);
return
(
-
1
);
}
stop_meas
(
&
eNB
->
ulsch_rate_unmatching_stats
);
max_Ncb
=
3
*
ulsch_harq
->
RTC
[
r
]
*
32
;
if
(
ulsch_harq
->
total_number_of_repetitions
>
1
)
{
if
(
ulsch_harq
->
rvidx
==
1
)
{
// Store the result of HARQ combining in the last emtc repetitions of sequence 0,2,3,1
for
(
int
nn
=
0
;
nn
<
max_Ncb
;
nn
++
)
{
pusch_rep_buffer
[
nn
]
+=
ulsch_harq
->
w
[
r
][
nn
]
;
}
}
if
(
ulsch_harq
->
repetition_number
==
ulsch_harq
->
total_number_of_repetitions
)
{
for
(
int
nn
=
0
;
nn
<
max_Ncb
;
nn
++
)
{
ulsch_harq
->
w
[
r
][
nn
]
=
pusch_rep_buffer
[
nn
]
;
}
}
}
r_offset
+=
E
;
start_meas
(
&
eNB
->
ulsch_deinterleaving_stats
);
#if 0
start_meas(&eNB->ulsch_deinterleaving_stats);
req=createRequest(DECODE,sizeof(turboDecode_t));
req->startUELoop=eNB->proc.threadPool.startProcessingUE;
union turboReqUnion id= {.s={eNB->ulsch[UE_id]->rnti,frame,subframe,r,0}};
req->id= id.p;
turboDecode_t * rdata=(turboDecode_t *) req->data;
#endif
sub_block_deinterleaving_turbo
(
4
+
Kr
,
&
ulsch_harq
->
d
[
r
][
96
],
ulsch_harq
->
w
[
r
]);
stop_meas
(
&
eNB
->
ulsch_deinterleaving_stats
);
if
(
ulsch_harq
->
C
==
1
)
union
turboReqUnion
id
=
{.
s
=
{
ulsch
->
rnti
,
proc
->
frame_rx
,
proc
->
subframe_rx
,
0
,
0
}};
crc_type
=
CRC24_A
;
notifiedFIFO_elt_t
*
req
=
newNotifiedFIFO_elt
(
sizeof
(
turboDecode_t
),
id
.
p
,
&
proc
->
respDecode
,
processULSegment
);
else
turboDecode_t
*
rdata
=
(
turboDecode_t
*
)
NotifiedFifoData
(
req
);
crc_type
=
CRC24_B
;
#if 0
rdata
->
eNB
=
eNB
;
rdata->frame=frame;
rdata
->
frame
=
proc
->
frame_rx
;
rdata->subframe=subframe;
rdata
->
subframe
=
proc
->
subframe_rx
;
rdata->UEid=UE_id;
rdata
->
UEid
=
UE_id
;
rdata->harq_pid=harq_pid;
rdata
->
harq_pid
=
harq_pid
;
rdata->Kr=Kr;
rdata
->
Kr
=
Kr
;
rdata->maxIterations=eNB->ulsch[UE_id]->max_turbo_iterations;
rdata
->
maxIterations
=
eNB
->
ulsch
[
UE_id
]
->
max_turbo_iterations
;
rdata->ulsch_harq=ulsch_harq;
rdata
->
ulsch_harq
=
ulsch_harq
;
rdata->eNB=eNB;
rdata
->
eNB
=
eNB
;
rdata->nbSegments=ulsch_harq->C;
rdata
->
nbSegments
=
ulsch_harq
->
C
;
rdata->segment_r=r;
rdata
->
segment_r
=
r
;
rdata->Fbits=(r==0) ? ulsch_harq->F : 0;
rdata
->
Fbits
=
(
r
==
0
)
?
ulsch_harq
->
F
:
0
;
rdata->offset=offset;
rdata
->
r_offset
=
r_offset
;
rdata->function=td;
rdata
->
offset
=
offset
;
int Fbytes=rdata->Fbits>>3;
rdata
->
function
=
td
;
int blockSize=Kr_bytes - Fbytes - (rdata->nbSegments>1?3:0);
int
Fbytes
=
(
r
==
0
)
?
rdata
->
Fbits
>>
3
:
0
;
if ( eNB->proc.threadPool.activated) {
int
sz
=
Kr_bytes
-
Fbytes
-
((
ulsch_harq
->
C
>
1
)
?
3
:
0
);
add_request(req, &eNB->proc.threadPool);
pushTpool
(
&
proc
->
threadPool
,
req
);
req=NULL;
proc
->
nbDecode
++
;
} else {
LOG_D
(
PHY
,
"Added a block to decode, in pipe: %d
\n
"
,
proc
->
nbDecode
);
req->startProcessingTime=rdtsc();
r_offset
+=
E
;
rdata->decodeIterations = td( rdata->soft_bits+96,
offset
+=
sz
;
rdata->decoded_bytes,
rdata->Kr,
f1f2mat_old[rdata->iind*2],
f1f2mat_old[(rdata->iind*2)+1],
rdata->maxIterations,
rdata->nbSegments == 1 ? CRC24_A: CRC24_B,
rdata->Fbits,
&eNB->ulsch_tc_init_stats,
&eNB->ulsch_tc_alpha_stats,
&eNB->ulsch_tc_beta_stats,
&eNB->ulsch_tc_gamma_stats,
&eNB->ulsch_tc_ext_stats,
&eNB->ulsch_tc_intl1_stats,
&eNB->ulsch_tc_intl2_stats);
stop_meas(&eNB->ulsch_turbo_decoding_stats);
req->returnTime=req->endProcessingTime=rdtsc();
req->decodeIterations=rdata->decodeIterations;
req->coreId=0;
req->processedBy[0]=0;
req->next=eNB->proc.threadPool.doneRequests;
eNB->proc.threadPool.doneRequests=req;
if (rdata->decodeIterations > eNB->ulsch[UE_id]->max_turbo_iterations )
// Entire TPU need retransmission
break;
}
offset += blockSize;
eNB->proc.threadPool.startProcessingUE=rdtsc();
#endif
start_meas
(
&
eNB
->
ulsch_turbo_decoding_stats
);
ret
=
tc
(
&
ulsch_harq
->
d
[
r
][
96
],
NULL
,
ulsch_harq
->
c
[
r
],
NULL
,
Kr
,
ulsch
->
max_turbo_iterations
,
//MAX_TURBO_ITERATIONS,
crc_type
,
(
r
==
0
)
?
ulsch_harq
->
F
:
0
,
&
eNB
->
ulsch_tc_init_stats
,
&
eNB
->
ulsch_tc_alpha_stats
,
&
eNB
->
ulsch_tc_beta_stats
,
&
eNB
->
ulsch_tc_gamma_stats
,
&
eNB
->
ulsch_tc_ext_stats
,
&
eNB
->
ulsch_tc_intl1_stats
,
&
eNB
->
ulsch_tc_intl2_stats
);
stop_meas
(
&
eNB
->
ulsch_turbo_decoding_stats
);
LOG_D
(
PHY
,
"turbo decode in %d iter
\n
"
,
ret
);
// Reassembly of Transport block here
if
(
ret
!=
(
1
+
ulsch
->
max_turbo_iterations
))
{
if
(
r
<
ulsch_harq
->
Cminus
)
Kr
=
ulsch_harq
->
Kminus
;
else
Kr
=
ulsch_harq
->
Kplus
;
Kr_bytes
=
Kr
>>
3
;
if
(
r
==
0
)
{
memcpy
(
ulsch_harq
->
b
,
&
ulsch_harq
->
c
[
0
][(
ulsch_harq
->
F
>>
3
)],
Kr_bytes
-
(
ulsch_harq
->
F
>>
3
)
-
((
ulsch_harq
->
C
>
1
)
?
3
:
0
));
offset
=
Kr_bytes
-
(
ulsch_harq
->
F
>>
3
)
-
((
ulsch_harq
->
C
>
1
)
?
3
:
0
);
}
else
{
memcpy
(
ulsch_harq
->
b
+
offset
,
ulsch_harq
->
c
[
r
],
Kr_bytes
-
((
ulsch_harq
->
C
>
1
)
?
3
:
0
));
offset
+=
(
Kr_bytes
-
((
ulsch_harq
->
C
>
1
)
?
3
:
0
));
}
}
else
{
break
;
}
}
}
return
(
ret
);
return
(
ret
);
}
}
int
ulsch_decoding_data_all
(
PHY_VARS_eNB
*
eNB
,
int
UE_id
,
int
harq_pid
,
int
llr8_flag
)
{
int
ulsch_decoding_data_all
(
PHY_VARS_eNB
*
eNB
,
L1_rxtx_proc_t
*
proc
,
int
ret
=
0
;
int
UE_id
,
int
harq_pid
,
int
llr8_flag
)
{
/*if(get_thread_worker_conf() == WORKER_ENABLE)
return
ulsch_decoding_data
(
eNB
,
proc
,
UE_id
,
harq_pid
,
llr8_flag
);
{
ret = ulsch_decoding_data_2thread(eNB,UE_id,harq_pid,llr8_flag);
}
else*/
{
ret
=
ulsch_decoding_data
(
eNB
,
UE_id
,
harq_pid
,
llr8_flag
);
}
return
ret
;
}
}
static
inline
unsigned
int
lte_gold_unscram
(
unsigned
int
*
x1
,
unsigned
int
*
x2
,
unsigned
char
reset
)
__attribute__
((
always_inline
));
static
inline
unsigned
int
lte_gold_unscram
(
unsigned
int
*
x1
,
unsigned
int
*
x2
,
unsigned
char
reset
)
__attribute__
((
always_inline
));
...
@@ -1158,7 +1086,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,
...
@@ -1158,7 +1086,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,
LOG_D
(
PHY
,
"frame %d subframe %d O_ACK:%d o_ACK[]=%d:%d:%d:%d
\n
"
,
frame
,
subframe
,
ulsch_harq
->
O_ACK
,
ulsch_harq
->
o_ACK
[
0
],
ulsch_harq
->
o_ACK
[
1
],
ulsch_harq
->
o_ACK
[
2
],
ulsch_harq
->
o_ACK
[
3
]);
LOG_D
(
PHY
,
"frame %d subframe %d O_ACK:%d o_ACK[]=%d:%d:%d:%d
\n
"
,
frame
,
subframe
,
ulsch_harq
->
O_ACK
,
ulsch_harq
->
o_ACK
[
0
],
ulsch_harq
->
o_ACK
[
1
],
ulsch_harq
->
o_ACK
[
2
],
ulsch_harq
->
o_ACK
[
3
]);
// Do ULSCH Decoding for data portion
// Do ULSCH Decoding for data portion
ret
=
ulsch_decoding_data_all
(
eNB
,
UE_id
,
harq_pid
,
llr8_flag
);
ret
=
ulsch_decoding_data_all
(
eNB
,
proc
,
UE_id
,
harq_pid
,
llr8_flag
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_ULSCH_DECODING0
+
harq_pid
,
0
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_ULSCH_DECODING0
+
harq_pid
,
0
);
return
(
ret
);
return
(
ret
);
}
}
openair1/PHY/defs_eNB.h
View file @
13122a27
...
@@ -871,20 +871,19 @@ union turboReqUnion {
...
@@ -871,20 +871,19 @@ union turboReqUnion {
};
};
typedef
struct
TurboDecode_s
{
typedef
struct
TurboDecode_s
{
decoder_if_t
*
function
;
PHY_VARS_eNB
*
eNB
;
int16_t
soft_bits
[
3
*
8
*
6144
+
12
+
96
]
__attribute__
((
aligned
(
32
)))
;
decoder_if_t
*
function
;
uint8_t
decoded_bytes
[
3
+
768
]
__attribute__
((
aligned
(
32
)));
uint8_t
decoded_bytes
[
3
+
1
768
]
__attribute__
((
aligned
(
32
)));
int
UEid
;
int
UEid
;
int
harq_pid
;
int
harq_pid
;
int
frame
;
int
frame
;
int
subframe
;
int
subframe
;
int
iind
;
int
Fbits
;
int
Fbits
;
int
Kr
;
int
Kr
;
LTE_UL_eNB_HARQ_t
*
ulsch_harq
;
LTE_UL_eNB_HARQ_t
*
ulsch_harq
;
PHY_VARS_eNB
*
eNB
;
int
nbSegments
;
int
nbSegments
;
int
segment_r
;
int
segment_r
;
int
r_offset
;
int
offset
;
int
offset
;
int
maxIterations
;
int
maxIterations
;
int
decodeIterations
;
int
decodeIterations
;
...
...
openair1/SCHED/phy_procedures_lte_eNb.c
View file @
13122a27
...
@@ -310,7 +310,7 @@ bool dlsch_procedures(PHY_VARS_eNB *eNB,
...
@@ -310,7 +310,7 @@ bool dlsch_procedures(PHY_VARS_eNB *eNB,
if
(
proc
->
threadPool
.
activated
)
{
if
(
proc
->
threadPool
.
activated
)
{
// Wait all other threads finish to process
// Wait all other threads finish to process
while
(
proc
->
nbEncode
)
{
while
(
proc
->
nbEncode
)
{
pullTpool
(
&
proc
->
respEncode
,
&
proc
->
threadPool
);
delNotifiedFIFO_elt
(
pullTpool
(
&
proc
->
respEncode
,
&
proc
->
threadPool
)
);
proc
->
nbEncode
--
;
proc
->
nbEncode
--
;
}
}
}
}
...
@@ -1165,86 +1165,92 @@ uci_procedures(PHY_VARS_eNB *eNB,
...
@@ -1165,86 +1165,92 @@ uci_procedures(PHY_VARS_eNB *eNB,
}
// end loop for (int i = 0; i < NUMBER_OF_UE_MAX; i++) {
}
// end loop for (int i = 0; i < NUMBER_OF_UE_MAX; i++) {
}
}
#if 0
void
postDecode
(
L1_rxtx_proc_t
*
proc
,
notifiedFIFO_elt_t
*
req
)
{
void post_decode(request_t* decodeResult) {
turboDecode_t
*
rdata
=
(
turboDecode_t
*
)
NotifiedFifoData
(
req
);
turboDecode_t * rdata=(turboDecode_t *) decodeResult->data;
LTE_eNB_ULSCH_t *ulsch = rdata->eNB->ulsch[rdata->UEid];
LTE_UL_eNB_HARQ_t *ulsch_harq = rdata->ulsch_harq;
PHY_VARS_eNB *eNB=rdata->eNB;
bool decodeSucess=rdata->decodeIterations <= rdata->maxIterations;
ulsch_harq->processedSegments++;
if (decodeSucess) {
int Fbytes=rdata->Fbits>>3;
int Kr=rdata->segment_r < ulsch_harq->Cminus?
ulsch_harq->Kminus:
ulsch_harq->Kplus;
int Kr_bytes = Kr>>3;
int blockSize=Kr_bytes - Fbytes - (rdata->nbSegments>1?3:0);
memcpy(ulsch_harq->b+rdata->offset,
rdata->decoded_bytes+Fbytes,
blockSize);
} else {
LTE_eNB_ULSCH_t
*
ulsch
=
rdata
->
eNB
->
ulsch
[
rdata
->
UEid
];
if (rdata->nbSegments > 1 ) {
LTE_UL_eNB_HARQ_t
*
ulsch_harq
=
rdata
->
ulsch_harq
;
// Purge pending decoding of the same TDU
PHY_VARS_eNB
*
eNB
=
rdata
->
eNB
;
union turboReqUnion idInFailure= {.p=decodeResult->id};
rnti_t rntiInFailure=idInFailure.s.rnti;
bool
decodeSucess
=
rdata
->
decodeIterations
<=
rdata
->
maxIterations
;
tpool_t * tp=&proc->threadPool;
ulsch_harq
->
processedSegments
++
;
mutexlock(tp->lockRequests);
LOG_D
(
PHY
,
"processing result of segment: %d, ue %d, processed %d/%d
\n
"
,
request_t* pending=NULL;
rdata
->
segment_r
,
rdata
->
UEid
,
ulsch_harq
->
processedSegments
,
rdata
->
nbSegments
);
while ( (pending=searchRNTI(tp, rntiInFailure)) != NULL) {
proc
->
nbDecode
--
;
LOG_W(MAC,"removing a CB belonging to a bad TPU");
LOG_D
(
PHY
,
"remain to decoded in subframe: %d
\n
"
,
proc
->
nbDecode
);
freeRequest(pending);
if
(
decodeSucess
)
{
mutexlock(tp->lockReportDone);
int
Fbytes
=
(
rdata
->
segment_r
==
0
)
?
rdata
->
Fbits
>>
3
:
0
;
tp->notFinishedJobs--;
int
sz
=
(
rdata
->
Kr
>>
3
)
-
Fbytes
-
((
ulsch_harq
->
C
>
1
)
?
3
:
0
);
mutexunlock(tp->lockReportDone);
memcpy
(
ulsch_harq
->
b
+
rdata
->
offset
,
}
rdata
->
decoded_bytes
+
Fbytes
,
mutexunlock(tp->lockRequests);
sz
);
}
}
else
{
if
(
rdata
->
nbSegments
!=
ulsch_harq
->
processedSegments
)
{
int
nb
=
abortTpool
(
&
proc
->
threadPool
,
req
->
key
);
printf
(
"nb1:%d
\n
"
,
nb
);
nb
+=
abortNotifiedFIFO
(
&
proc
->
respDecode
,
req
->
key
);
printf
(
"nb2:%d
\n
"
,
nb
);
proc
->
nbDecode
-=
nb
;
LOG_I
(
PHY
,
"uplink segment error %d/%d, aborted %d segments"
,
rdata
->
segment_r
,
rdata
->
nbSegments
,
nb
);
AssertFatal
(
ulsch_harq
->
processedSegments
+
nb
==
rdata
->
nbSegments
,
"processed: %d, aborted: %d, total %d
\n
"
,
ulsch_harq
->
processedSegments
,
nb
,
rdata
->
nbSegments
);
ulsch_harq
->
processedSegments
=
rdata
->
nbSegments
;
}
}
}
// Check if TDU is complete: either we have all blocks in success
// if this UE segments are all done
// either at least one block can't be decoded
if
(
rdata
->
nbSegments
==
ulsch_harq
->
processedSegments
)
{
// Maybe we receive decoded block alter a first failure,
//compute the expected ULSCH RX power (for the stats)
// so we protect ourselves against multiple executions
int
i
=
rdata
->
UEid
;
if ( (rdata->nbSegments == ulsch_harq->processedSegments || decodeSucess==false) &&
ulsch_harq
->
delta_TF
=
get_hundred_times_delta_IF_eNB
(
eNB
,
i
,
rdata
->
harq_pid
,
0
);
// 0 means bw_factor is not considered
ulsch_harq->processedBadSegment == 0 ) {
if
(
RC
.
mac
!=
NULL
)
{
/* ulsim does not use RC.mac context. */
//compute the expected ULSCH RX power (for the stats)
if
(
ulsch_harq
->
cqi_crc_status
==
1
)
{
ulsch_harq->delta_TF = get_hundred_times_delta_IF_eNB(eNB,rdata->UEid,rdata->harq_pid, 0); // 0 means bw_factor is not considered
fill_ulsch_cqi_indication
(
eNB
,
rdata
->
frame
,
rdata
->
subframe
,
ulsch_harq
,
ulsch
->
rnti
);
RC
.
mac
[
eNB
->
Mod_id
]
->
UE_list
.
UE_sched_ctrl
[
i
].
cqi_req_flag
&=
(
~
(
1
<<
rdata
->
subframe
));
if (ulsch_harq->cqi_crc_status == 1)
}
else
{
fill_ulsch_cqi_indication(eNB,rdata->frame,rdata->subframe,
if
(
RC
.
mac
[
eNB
->
Mod_id
]
->
UE_list
.
UE_sched_ctrl
[
i
].
cqi_req_flag
&
(
1
<<
rdata
->
subframe
)
)
{
ulsch_harq,
RC
.
mac
[
eNB
->
Mod_id
]
->
UE_list
.
UE_sched_ctrl
[
i
].
cqi_req_flag
&=
(
~
(
1
<<
rdata
->
subframe
));
ulsch->rnti);
RC
.
mac
[
eNB
->
Mod_id
]
->
UE_list
.
UE_sched_ctrl
[
i
].
cqi_req_timer
=
30
;
LOG_D
(
PHY
,
"Frame %d,Subframe %d, We're supposed to get a cqi here. Set cqi_req_timer to 30.
\n
"
,
rdata
->
frame
,
rdata
->
subframe
);
fill_crc_indication(eNB,rdata->UEid,rdata->frame,rdata->subframe,decodeSucess?0:1); // indicate result to MAC
}
fill_rx_indication(eNB,rdata->UEid,rdata->frame,rdata->subframe); // indicate SDU to MAC
}
}
if (!decodeSucess) {
ulsch_harq->processedBadSegment =1;
if
(
!
decodeSucess
)
{
if (ulsch_harq->round >= 3) {
fill_crc_indication
(
eNB
,
i
,
rdata
->
frame
,
rdata
->
subframe
,
1
);
// indicate NAK to MAC
ulsch_harq->status = SCH_IDLE;
fill_rx_indication
(
eNB
,
i
,
rdata
->
frame
,
rdata
->
subframe
);
// indicate SDU to MAC
ulsch_harq->handled = 0;
LOG_D
(
PHY
,
"[eNB %d][PUSCH %d] frame %d subframe %d UE %d Error receiving ULSCH, round %d/%d (ACK %d,%d)
\n
"
,
ulsch->harq_mask &= ~(1 << rdata->harq_pid);
eNB
->
Mod_id
,
rdata
->
harq_pid
,
ulsch_harq->round = 0;
rdata
->
frame
,
rdata
->
subframe
,
i
,
}
ulsch_harq
->
round
,
ulsch
->
Mlimit
,
/* Mark the HARQ process to release it later if max transmission reached
ulsch_harq
->
o_ACK
[
0
],
* (see below).
ulsch_harq
->
o_ACK
[
1
]);
* MAC does not send the max transmission count, we have to deal with it
* locally in PHY.
if
(
ulsch_harq
->
round
>=
3
)
{
*/
ulsch_harq
->
status
=
SCH_IDLE
;
ulsch_harq->handled = 1;
ulsch_harq
->
handled
=
0
;
} else {
ulsch
->
harq_mask
&=
~
(
1
<<
rdata
->
harq_pid
);
ulsch_harq->status = SCH_IDLE;
ulsch_harq
->
round
=
0
;
ulsch->harq_mask &= ~(1 << rdata->harq_pid);
}
} // ulsch not in error
/* Mark the HARQ process to release it later if max transmission reached
* (see below).
if (ulsch_harq->O_ACK>0)
* MAC does not send the max transmission count, we have to deal with it
fill_ulsch_harq_indication(eNB,ulsch_harq,ulsch->rnti,rdata->frame,rdata->subframe,ulsch->bundling);
* locally in PHY.
}
*/
ulsch_harq
->
handled
=
1
;
}
// ulsch in error
else
if
(
ulsch_harq
->
repetition_number
==
ulsch_harq
->
total_number_of_repetitions
){
fill_crc_indication
(
eNB
,
i
,
rdata
->
frame
,
rdata
->
subframe
,
0
);
// indicate ACK to MAC
fill_rx_indication
(
eNB
,
i
,
rdata
->
frame
,
rdata
->
subframe
);
// indicate SDU to MAC
ulsch_harq
->
status
=
SCH_IDLE
;
ulsch
->
harq_mask
&=
~
(
1
<<
rdata
->
harq_pid
);
}
// ulsch not in error
if
(
ulsch_harq
->
O_ACK
>
0
)
fill_ulsch_harq_indication
(
eNB
,
ulsch_harq
,
ulsch
->
rnti
,
rdata
->
frame
,
rdata
->
subframe
,
ulsch
->
bundling
);
}
}
}
#endif
void
pusch_procedures
(
PHY_VARS_eNB
*
eNB
,
L1_rxtx_proc_t
*
proc
)
{
void
pusch_procedures
(
PHY_VARS_eNB
*
eNB
,
L1_rxtx_proc_t
*
proc
)
{
uint32_t
ret
=
0
,
i
;
uint32_t
ret
=
0
,
i
;
...
@@ -1316,121 +1322,7 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
...
@@ -1316,121 +1322,7 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
ulsch_harq
->
V_UL_DAI
,
ulsch_harq
->
V_UL_DAI
,
ulsch_harq
->
nb_rb
>
20
?
1
:
0
);
ulsch_harq
->
nb_rb
>
20
?
1
:
0
);
stop_meas
(
&
eNB
->
ulsch_decoding_stats
);
stop_meas
(
&
eNB
->
ulsch_decoding_stats
);
LOG_D
(
PHY
,
}
"[eNB %d][PUSCH %d] frame %d subframe %d RNTI %x RX power (%d,%d) N0 (%d,%d) dB ACK (%d,%d), decoding iter %d ulsch_harq->cqi_crc_status:%d ackBits:%d ulsch_decoding_stats[t:%lld max:%lld]
\n
"
,
eNB
->
Mod_id
,
harq_pid
,
frame
,
subframe
,
ulsch
->
rnti
,
dB_fixed
(
eNB
->
pusch_vars
[
i
]
->
ulsch_power
[
0
]),
dB_fixed
(
eNB
->
pusch_vars
[
i
]
->
ulsch_power
[
1
]),
30
,
//eNB->measurements.n0_power_dB[0],
30
,
//eNB->measurements.n0_power_dB[1],
ulsch_harq
->
o_ACK
[
0
],
ulsch_harq
->
o_ACK
[
1
],
ret
,
ulsch_harq
->
cqi_crc_status
,
ulsch_harq
->
O_ACK
,
eNB
->
ulsch_decoding_stats
.
p_time
,
eNB
->
ulsch_decoding_stats
.
max
);
if
(
ulsch_harq
->
repetition_number
<
ulsch_harq
->
total_number_of_repetitions
){
ulsch_harq
->
rvidx
=
rvidx_tab
[(
ulsch_harq
->
repetition_number
%
4
)]
;
// Set the correct rvidx for the next emtc repetitions
ulsch_harq
->
repetition_number
+=
1
;
// Increment repetition_number for the next ULSCH allocation
}
//compute the expected ULSCH RX power (for the stats)
ulsch_harq
->
delta_TF
=
get_hundred_times_delta_IF_eNB
(
eNB
,
i
,
harq_pid
,
0
);
// 0 means bw_factor is not considered
if
(
RC
.
mac
!=
NULL
)
{
/* ulsim does not use RC.mac context. */
if
(
ulsch_harq
->
cqi_crc_status
==
1
)
{
#ifdef DEBUG_PHY_PROC
//if (((frame%10) == 0) || (frame < 50))
print_CQI
(
ulsch_harq
->
o
,
ulsch_harq
->
uci_format
,
0
,
fp
->
N_RB_DL
);
#endif
fill_ulsch_cqi_indication
(
eNB
,
frame
,
subframe
,
ulsch_harq
,
ulsch
->
rnti
);
RC
.
mac
[
eNB
->
Mod_id
]
->
UE_list
.
UE_sched_ctrl
[
i
].
cqi_req_flag
&=
(
~
(
1
<<
subframe
));
}
else
{
if
(
RC
.
mac
[
eNB
->
Mod_id
]
->
UE_list
.
UE_sched_ctrl
[
i
].
cqi_req_flag
&
(
1
<<
subframe
)
)
{
RC
.
mac
[
eNB
->
Mod_id
]
->
UE_list
.
UE_sched_ctrl
[
i
].
cqi_req_flag
&=
(
~
(
1
<<
subframe
));
RC
.
mac
[
eNB
->
Mod_id
]
->
UE_list
.
UE_sched_ctrl
[
i
].
cqi_req_timer
=
30
;
LOG_D
(
PHY
,
"Frame %d,Subframe %d, We're supposed to get a cqi here. Set cqi_req_timer to 30.
\n
"
,
frame
,
subframe
);
}
}
}
if
(
ret
==
(
1
+
MAX_TURBO_ITERATIONS
))
{
T
(
T_ENB_PHY_ULSCH_UE_NACK
,
T_INT
(
eNB
->
Mod_id
),
T_INT
(
frame
),
T_INT
(
subframe
),
T_INT
(
ulsch
->
rnti
),
T_INT
(
harq_pid
));
fill_crc_indication
(
eNB
,
i
,
frame
,
subframe
,
1
);
// indicate NAK to MAC
fill_rx_indication
(
eNB
,
i
,
frame
,
subframe
);
// indicate SDU to MAC
LOG_D
(
PHY
,
"[eNB %d][PUSCH %d] frame %d subframe %d UE %d Error receiving ULSCH, round %d/%d (ACK %d,%d)
\n
"
,
eNB
->
Mod_id
,
harq_pid
,
frame
,
subframe
,
i
,
ulsch_harq
->
round
,
ulsch
->
Mlimit
,
ulsch_harq
->
o_ACK
[
0
],
ulsch_harq
->
o_ACK
[
1
]);
if
(
ulsch_harq
->
round
>=
3
)
{
ulsch_harq
->
status
=
SCH_IDLE
;
ulsch_harq
->
handled
=
0
;
ulsch
->
harq_mask
&=
~
(
1
<<
harq_pid
);
ulsch_harq
->
round
=
0
;
}
MSC_LOG_RX_DISCARDED_MESSAGE
(
MSC_PHY_ENB
,
MSC_PHY_UE
,
NULL
,
0
,
"%05u:%02u ULSCH received rnti %x harq id %u round %d"
,
frame
,
subframe
,
ulsch
->
rnti
,
harq_pid
,
ulsch_harq
->
round
-
1
);
/* Mark the HARQ process to release it later if max transmission reached
* (see below).
* MAC does not send the max transmission count, we have to deal with it
* locally in PHY.
*/
ulsch_harq
->
handled
=
1
;
}
// ulsch in error
else
if
(
ulsch_harq
->
repetition_number
==
ulsch_harq
->
total_number_of_repetitions
){
fill_crc_indication
(
eNB
,
i
,
frame
,
subframe
,
0
);
// indicate ACK to MAC
fill_rx_indication
(
eNB
,
i
,
frame
,
subframe
);
// indicate SDU to MAC
ulsch_harq
->
status
=
SCH_IDLE
;
ulsch
->
harq_mask
&=
~
(
1
<<
harq_pid
);
T
(
T_ENB_PHY_ULSCH_UE_ACK
,
T_INT
(
eNB
->
Mod_id
),
T_INT
(
frame
),
T_INT
(
subframe
),
T_INT
(
ulsch
->
rnti
),
T_INT
(
harq_pid
));
MSC_LOG_RX_MESSAGE
(
MSC_PHY_ENB
,
MSC_PHY_UE
,
NULL
,
0
,
"%05u:%02u ULSCH received rnti %x harq id %u"
,
frame
,
subframe
,
ulsch
->
rnti
,
harq_pid
);
#ifdef DEBUG_PHY_PROC
#ifdef DEBUG_ULSCH
LOG_D
(
PHY
,
"[eNB] Frame %d, Subframe %d : ULSCH SDU (RX harq_pid %d) %d bytes:"
,
frame
,
subframe
,
harq_pid
,
ulsch_harq
->
TBS
>>
3
);
for
(
j
=
0
;
j
<
ulsch_harq
->
TBS
>>
3
;
j
++
)
LOG_T
(
PHY
,
"%x."
,
ulsch
->
harq_processes
[
harq_pid
]
->
b
[
j
]);
LOG_T
(
PHY
,
"
\n
"
);
#endif
#endif
}
// ulsch not in error
if
(
ulsch_harq
->
O_ACK
>
0
)
fill_ulsch_harq_indication
(
eNB
,
ulsch_harq
,
ulsch
->
rnti
,
frame
,
subframe
,
ulsch
->
bundling
);
LOG_D
(
PHY
,
"[eNB %d] Frame %d subframe %d: received ULSCH harq_pid %d for UE %d, ret = %d, CQI CRC Status %d, ACK %d,%d, ulsch_errors %d/%d
\n
"
,
eNB
->
Mod_id
,
frame
,
subframe
,
harq_pid
,
i
,
ret
,
ulsch_harq
->
cqi_crc_status
,
ulsch_harq
->
o_ACK
[
0
],
ulsch_harq
->
o_ACK
[
1
],
eNB
->
UE_stats
[
i
].
ulsch_errors
[
harq_pid
],
eNB
->
UE_stats
[
i
].
ulsch_decoding_attempts
[
harq_pid
][
0
]);
}
// if ((ulsch) &&
// (ulsch->rnti>0) &&
// (ulsch_harq->status == ACTIVE))
else
if
((
ulsch
)
&&
else
if
((
ulsch
)
&&
(
ulsch
->
rnti
>
0
)
&&
(
ulsch
->
rnti
>
0
)
&&
(
ulsch_harq
->
status
==
ACTIVE
)
&&
(
ulsch_harq
->
status
==
ACTIVE
)
&&
...
@@ -1444,56 +1336,17 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
...
@@ -1444,56 +1336,17 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
LOG_W
(
PHY
,
"Removing stale ULSCH config for UE %x harq_pid %d (harq_mask is now 0x%2.2x)
\n
"
,
ulsch
->
rnti
,
harq_pid
,
ulsch
->
harq_mask
);
LOG_W
(
PHY
,
"Removing stale ULSCH config for UE %x harq_pid %d (harq_mask is now 0x%2.2x)
\n
"
,
ulsch
->
rnti
,
harq_pid
,
ulsch
->
harq_mask
);
}
}
}
// for (i=0; i<NUMBER_OF_UE_MAX; i++)
}
// for (i=0; i<NUMBER_OF_UE_MAX; i++)
#if 0
if ( proc->threadPool.activated ) {
while
(
proc
->
nbDecode
>
0
)
{
// Wait all other threads finish to process
notifiedFIFO_elt_t
*
req
=
pullTpool
(
&
proc
->
respDecode
,
&
proc
->
threadPool
);
//printf("%s:%d:%d\n", __FILE__,__LINE__,eNB->proc->threadPool.notFinishedJobs);
postDecode
(
proc
,
req
);
int rr=0;
delNotifiedFIFO_elt
(
req
);
mutexlock(proc->threadPool.lockReportDone);
}
while ( proc->threadPool.notFinishedJobs > 0 ) {
//printf("%s:%d:%d\n", __FILE__,__LINE__,eNB->proc->threadPool.notFinishedJobs);
struct timespec t;
clock_gettime(CLOCK_REALTIME,&t);
t.tv_nsec+=1*1000*1000;
if ( t.tv_nsec >= 1000*1000*1000 ) {
t.tv_nsec -= 1000*1000*1000;
t.tv_sec++;
}
if ((rr=pthread_cond_timedwait(&proc->threadPool.notifDone,&proc.threadPool.lockReportDone, &t))!=0) {
LOG_E(PHY,"timedwait1:%s,%p,%p,%p,%d\n", rr==ETIMEDOUT?"ETIMEDOUT":"other",
proc->threadPool.oldestRequests,
proc->threadPool.newestRequests,
proc->threadPool.doneRequests,
proc->threadPool.notFinishedJobs);
proc->threadPool.oldestRequests=NULL;
proc->threadPool.newestRequests=NULL;
proc->threadPool.doneRequests=NULL;
proc->threadPool.notFinishedJobs=0;
}
}
mutexunlock(proc->threadPool.lockReportDone);
}
request_t* tmp;
while ((tmp=proc->threadPool.doneRequests)!=NULL) {
turboDecode_t * rdata=(turboDecode_t *) tmp->data;
tmp->decodeIterations=rdata->decodeIterations;
post_decode(tmp);
tmp->returnTime=rdtsc();
tmp->cumulSubframe=tmp->returnTime-startTime;
// Ignore write error (if no trace listner)
if (write(proc->threadPool.traceFd, tmp, sizeof(request_t)- 2*sizeof(void*))) {};
proc->threadPool.doneRequests=tmp->next;
freeRequest(tmp);
}
#endif
}
}
extern
int
oai_exit
;
extern
void
*
td_thread
(
void
*
)
;
extern
int
oai_exit
;
extern
void
*
te_thread
(
void
*
);
void
fill_rx_indication
(
PHY_VARS_eNB
*
eNB
,
int
UE_id
,
int
frame
,
int
subframe
)
{
void
fill_rx_indication
(
PHY_VARS_eNB
*
eNB
,
int
UE_id
,
int
frame
,
int
subframe
)
{
nfapi_rx_indication_pdu_t
*
pdu
;
nfapi_rx_indication_pdu_t
*
pdu
;
...
...
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