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
Michael Black
OpenXG-RAN
Commits
10eedd66
Commit
10eedd66
authored
Aug 25, 2022
by
Sagar Parsawar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed memory leak issue of nr_gold_prs buffer in gNB
parent
006421d7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
22 deletions
+34
-22
executables/nr-ue.c
executables/nr-ue.c
+9
-6
openair1/PHY/INIT/nr_init.c
openair1/PHY/INIT/nr_init.c
+11
-0
openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
+9
-16
openair1/PHY/defs_nr_UE.h
openair1/PHY/defs_nr_UE.h
+5
-0
No files found.
executables/nr-ue.c
View file @
10eedd66
...
...
@@ -268,6 +268,9 @@ void init_nr_prs_ue_vars(PHY_VARS_NR_UE *ue)
for
(
int
idx
=
0
;
idx
<
NR_MAX_PRS_COMB_SIZE
;
idx
++
)
{
prs_vars
[
idx
]
=
(
NR_UE_PRS
*
)
malloc16_clear
(
sizeof
(
NR_UE_PRS
));
prs_vars
[
idx
]
->
ch_tmp
=
(
int16_t
*
)
malloc16_clear
(
fp
->
ofdm_symbol_size
*
sizeof
(
int32_t
));
prs_vars
[
idx
]
->
chF_interpol
=
(
int16_t
*
)
malloc16_clear
(
NR_PRS_IDFT_OVERSAMP_FACTOR
*
fp
->
ofdm_symbol_size
*
sizeof
(
int32_t
));
prs_vars
[
idx
]
->
chT_interpol
=
(
int16_t
*
)
malloc16_clear
(
NR_PRS_IDFT_OVERSAMP_FACTOR
*
fp
->
ofdm_symbol_size
*
sizeof
(
int32_t
));
for
(
int
k
=
0
;
k
<
NR_MAX_PRS_RESOURCES_PER_SET
;
k
++
)
{
// PRS channel estimates
...
...
@@ -277,12 +280,12 @@ void init_nr_prs_ue_vars(PHY_VARS_NR_UE *ue)
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_meas
=
(
prs_meas_t
**
)
malloc16_clear
(
fp
->
nb_antennas_rx
*
sizeof
(
prs_meas_t
*
)
);
AssertFatal
((
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_meas
!=
NULL
),
"NR UE init: PRS measurements malloc failed for gNB_id %d
\n
"
,
idx
);
for
(
int
i
=
0
;
i
<
fp
->
nb_antennas_rx
;
i
++
)
{
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_ch_estimates
[
i
]
=
(
int32_t
*
)
malloc16_clear
(
fp
->
ofdm_symbol_size
*
sizeof
(
int32_t
));
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_ch_estimates_time
[
i
]
=
(
int32_t
*
)
malloc16_clear
(
fp
->
ofdm_symbol_size
*
sizeof
(
int32_t
));
AssertFatal
(((
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_ch_estimates
[
i
]
!=
NULL
)
||
(
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_ch_estimates_time
[
i
]
!=
NULL
)),
"NR UE init: PRS channel estimates malloc failed for rx_ant %d
\n
"
,
i
);
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_meas
[
i
]
=
(
prs_meas_t
*
)
malloc16_clear
(
sizeof
(
prs_meas_t
)
);
AssertFatal
((
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_meas
[
i
]
!=
NULL
),
"NR UE init: PRS measurements malloc failed for rx_ant %d
\n
"
,
i
);
for
(
int
j
=
0
;
j
<
fp
->
nb_antennas_rx
;
j
++
)
{
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_ch_estimates
[
j
]
=
(
int32_t
*
)
malloc16_clear
(
fp
->
ofdm_symbol_size
*
sizeof
(
int32_t
));
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_ch_estimates_time
[
j
]
=
(
int32_t
*
)
malloc16_clear
(
fp
->
ofdm_symbol_size
*
sizeof
(
int32_t
));
AssertFatal
(((
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_ch_estimates
[
j
]
!=
NULL
)
||
(
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_ch_estimates_time
[
j
]
!=
NULL
)),
"NR UE init: PRS channel estimates malloc failed for rx_ant %d
\n
"
,
j
);
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_meas
[
j
]
=
(
prs_meas_t
*
)
malloc16_clear
(
sizeof
(
prs_meas_t
)
);
AssertFatal
((
prs_vars
[
idx
]
->
prs_resource
[
k
].
prs_meas
[
j
]
!=
NULL
),
"NR UE init: PRS measurements malloc failed for rx_ant %d
\n
"
,
j
);
}
}
}
...
...
openair1/PHY/INIT/nr_init.c
View file @
10eedd66
...
...
@@ -801,6 +801,17 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
free_and_zero
(
common_vars
->
beam_id
[
i
]);
}
for
(
int
rsc
=
0
;
rsc
<
gNB
->
prs_vars
.
NumPRSResources
;
rsc
++
)
{
for
(
int
slot
=
0
;
slot
<
fp
->
slots_per_frame
;
slot
++
)
{
for
(
int
symb
=
0
;
symb
<
fp
->
symbols_per_slot
;
symb
++
)
{
free_and_zero
(
gNB
->
nr_gold_prs
[
rsc
][
slot
][
symb
]);
}
free_and_zero
(
gNB
->
nr_gold_prs
[
rsc
][
slot
]);
}
free_and_zero
(
gNB
->
nr_gold_prs
[
rsc
]);
}
free_and_zero
(
gNB
->
nr_gold_prs
);
/* Do NOT free per-antenna txdataF/rxdataF: the gNB gets a pointer to the
* RU's txdataF/rxdataF, and the RU will free that */
free_and_zero
(
common_vars
->
txdataF
);
...
...
openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
View file @
10eedd66
...
...
@@ -38,7 +38,6 @@
//#define DEBUG_CH
//#define DEBUG_PRS_CHEST
//#define DEBUG_PRS_PRINTS
#define IDFT_INTERPOL_FACTOR 1
extern
short
nr_qpsk_mod_table
[
8
];
static
inline
int
abs32
(
int
x
)
...
...
@@ -58,6 +57,9 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
prs_meas_t
**
prs_meas
=
ue
->
prs_vars
[
gNB_id
]
->
prs_resource
[
rsc_id
].
prs_meas
;
int32_t
**
prs_chestF
=
ue
->
prs_vars
[
gNB_id
]
->
prs_resource
[
rsc_id
].
prs_ch_estimates
;
int32_t
**
prs_chestT
=
ue
->
prs_vars
[
gNB_id
]
->
prs_resource
[
rsc_id
].
prs_ch_estimates_time
;
int16_t
*
ch_tmp
=
ue
->
prs_vars
[
gNB_id
]
->
ch_tmp
;
int16_t
*
chF_interpol
=
ue
->
prs_vars
[
gNB_id
]
->
chF_interpol
;
int16_t
*
chT_interpol
=
ue
->
prs_vars
[
gNB_id
]
->
chT_interpol
;
int
slot_prs
=
(
proc
->
nr_slot_rx
-
rep_num
*
prs_cfg
->
PRSResourceTimeGap
+
frame_params
->
slots_per_frame
)
%
frame_params
->
slots_per_frame
;
uint32_t
**
nr_gold_prs
=
ue
->
nr_gold_prs
[
gNB_id
][
rsc_id
][
slot_prs
];
...
...
@@ -65,12 +67,6 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
int16_t
*
rxF
,
*
pil
,
*
fl
,
*
fm
,
*
fmm
,
*
fml
,
*
fmr
,
*
fr
,
mod_prs
[
NR_MAX_PRS_LENGTH
<<
1
];
int16_t
ch
[
2
]
=
{
0
},
noiseFig
[
2
]
=
{
0
};
int16_t
k_prime
=
0
,
k
=
0
,
re_offset
=
0
,
first_half
=
0
,
second_half
=
0
;
int16_t
*
ch_tmp
=
(
int16_t
*
)
malloc16_clear
(
frame_params
->
ofdm_symbol_size
*
sizeof
(
int32_t
));
AssertFatal
((
ch_tmp
!=
NULL
),
"[%s] channel estimate buffer initialization failed!!"
,
__FUNCTION__
);
int16_t
*
chF_interpol
=
(
int16_t
*
)
malloc16_clear
(
IDFT_INTERPOL_FACTOR
*
frame_params
->
ofdm_symbol_size
*
sizeof
(
int32_t
));
AssertFatal
((
chF_interpol
!=
NULL
),
"[%s] channel estimate buffer initialization failed!!"
,
__FUNCTION__
);
int16_t
*
chT_interpol
=
(
int16_t
*
)
malloc16_clear
(
IDFT_INTERPOL_FACTOR
*
frame_params
->
ofdm_symbol_size
*
sizeof
(
int32_t
));
AssertFatal
((
chT_interpol
!=
NULL
),
"[%s] channel estimate buffer initialization failed!!"
,
__FUNCTION__
);
int32_t
ch_pwr
=
0
,
snr
=
0
;
#ifdef DEBUG_PRS_CHEST
char
filename
[
64
]
=
{
0
},
varname
[
64
]
=
{
0
};
...
...
@@ -78,7 +74,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
int16_t
*
ch_init
=
ch_tmp
;
int16_t
scale_factor
=
(
1
.
0
f
/
(
float
)(
prs_cfg
->
NumPRSSymbols
))
*
(
1
<<
15
);
int16_t
num_pilots
=
(
12
/
prs_cfg
->
CombSize
)
*
prs_cfg
->
NumRB
;
int16_t
start_offset
=
(
IDFT_INTERPOL
_FACTOR
-
1
)
*
frame_params
->
ofdm_symbol_size
>>
1
;
int16_t
start_offset
=
(
NR_PRS_IDFT_OVERSAMP
_FACTOR
-
1
)
*
frame_params
->
ofdm_symbol_size
>>
1
;
int16_t
k_prime_table
[
K_PRIME_TABLE_ROW_SIZE
][
K_PRIME_TABLE_COL_SIZE
]
=
PRS_K_PRIME_TABLE
;
for
(
int
l
=
prs_cfg
->
SymbolStart
;
l
<
prs_cfg
->
SymbolStart
+
prs_cfg
->
NumPRSSymbols
;
l
++
)
...
...
@@ -436,7 +432,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
// Time domain IMPULSE response
idft_size_idx_t
idftsizeidx
;
switch
(
IDFT_INTERPOL
_FACTOR
*
frame_params
->
ofdm_symbol_size
)
{
switch
(
NR_PRS_IDFT_OVERSAMP
_FACTOR
*
frame_params
->
ofdm_symbol_size
)
{
case
128
:
idftsizeidx
=
IDFT_128
;
break
;
...
...
@@ -472,7 +468,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
case
4096
:
idftsizeidx
=
IDFT_4096
;
break
;
// 16x IDFT oversampling
case
8192
:
idftsizeidx
=
IDFT_8192
;
break
;
...
...
@@ -511,7 +507,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
(
int16_t
*
)
&
chT_interpol
[
0
],
1
);
// rearrange impulse response
memcpy
((
int16_t
*
)
&
prs_chestT
[
rxAnt
][
0
],
&
chT_interpol
[
IDFT_INTERPOL
_FACTOR
*
frame_params
->
ofdm_symbol_size
],
(
frame_params
->
ofdm_symbol_size
>>
1
)
*
sizeof
(
int32_t
));
memcpy
((
int16_t
*
)
&
prs_chestT
[
rxAnt
][
0
],
&
chT_interpol
[
NR_PRS_IDFT_OVERSAMP
_FACTOR
*
frame_params
->
ofdm_symbol_size
],
(
frame_params
->
ofdm_symbol_size
>>
1
)
*
sizeof
(
int32_t
));
memcpy
((
int16_t
*
)
&
prs_chestT
[
rxAnt
][(
frame_params
->
ofdm_symbol_size
>>
1
)],
&
chT_interpol
[
start_offset
],
(
frame_params
->
ofdm_symbol_size
>>
1
)
*
sizeof
(
int32_t
));
// peak estimator
...
...
@@ -521,7 +517,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
&
ch_pwr
);
//prs measurements
prs_meas
[
rxAnt
]
->
dl_toa
-=
(
frame_params
->
ofdm_symbol_size
>>
1
);
prs_meas
[
rxAnt
]
->
dl_toa
-=
(
frame_params
->
ofdm_symbol_size
>>
1
);
// adjusting ToA wrt center
prs_meas
[
rxAnt
]
->
gNB_id
=
gNB_id
;
prs_meas
[
rxAnt
]
->
sfn
=
proc
->
frame_rx
;
prs_meas
[
rxAnt
]
->
slot
=
proc
->
nr_slot_rx
;
...
...
@@ -531,7 +527,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
#ifdef DEBUG_PRS_CHEST
sprintf
(
filename
,
"%s%i%s"
,
"PRSpilot_"
,
rxAnt
,
".m"
);
LOG_M
(
filename
,
"prs_loc"
,
&
mod_prs
[
0
],
prs_cfg
->
NumRB
*
(
12
/
prs_cfg
->
CombSize
)
,
1
,
1
);
LOG_M
(
filename
,
"prs_loc"
,
&
mod_prs
[
0
],
num_pilots
,
1
,
1
);
sprintf
(
filename
,
"%s%i%s"
,
"rxSigF_"
,
rxAnt
,
".m"
);
sprintf
(
varname
,
"%s%i"
,
"rxF_"
,
rxAnt
);
LOG_M
(
filename
,
varname
,
&
rxdataF
[
rxAnt
][
0
],
prs_cfg
->
NumPRSSymbols
*
frame_params
->
ofdm_symbol_size
,
1
,
1
);
...
...
@@ -557,9 +553,6 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
T_INT
(
rxAnt
),
T_BUFFER
(
&
prs_chestT
[
rxAnt
][
0
],
frame_params
->
ofdm_symbol_size
*
sizeof
(
int32_t
)));
}
free
(
ch_tmp
);
free
(
chF_interpol
);
free
(
chT_interpol
);
return
(
0
);
}
...
...
openair1/PHY/defs_nr_UE.h
View file @
10eedd66
...
...
@@ -346,6 +346,7 @@ typedef struct {
int32_t
**
ptrs_re_per_slot
;
}
NR_UE_PDSCH
;
#define NR_PRS_IDFT_OVERSAMP_FACTOR 1 // IDFT oversampling factor for NR PRS channel estimates in time domain, ALLOWED value 16x, and 1x is default(ie. IDFT size is frame_params->ofdm_symbol_size)
typedef
struct
{
prs_data_t
prs_cfg
;
int32_t
**
prs_ch_estimates
;
...
...
@@ -357,6 +358,10 @@ typedef struct {
typedef
struct
{
uint8_t
NumPRSResources
;
NR_PRS_RESOURCE_t
prs_resource
[
NR_MAX_PRS_RESOURCES_PER_SET
];
//temp buffers
int16_t
*
ch_tmp
;
int16_t
*
chF_interpol
;
int16_t
*
chT_interpol
;
}
NR_UE_PRS
;
#define NR_PDCCH_DEFS_NR_UE
...
...
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