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
796c2a61
Commit
796c2a61
authored
6 months ago
by
francescomani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improvements in RA init procedures according to 5.1.1 in 38.321
parent
939ce850
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
256 additions
and
204 deletions
+256
-204
openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c
openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c
+9
-10
openair2/LAYER2/NR_MAC_UE/config_ue.c
openair2/LAYER2/NR_MAC_UE/config_ue.c
+2
-2
openair2/LAYER2/NR_MAC_UE/mac_defs.h
openair2/LAYER2/NR_MAC_UE/mac_defs.h
+10
-13
openair2/LAYER2/NR_MAC_UE/mac_proto.h
openair2/LAYER2/NR_MAC_UE/mac_proto.h
+5
-0
openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
+192
-155
openair2/LAYER2/NR_MAC_UE/nr_ue_power_procedures.c
openair2/LAYER2/NR_MAC_UE/nr_ue_power_procedures.c
+6
-7
openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
+1
-4
openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_ra_procedures.cpp
openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_ra_procedures.cpp
+31
-13
No files found.
openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c
View file @
796c2a61
...
...
@@ -571,34 +571,33 @@ NR_tda_info_t get_dl_tda_info(const NR_UE_DL_BWP_t *dl_BWP,
return
tda_info
;
}
uint16_t
get_NCS
(
uint8_t
index
,
uint16_t
format0
,
uint8_t
restricted_set_config
)
{
LOG_D
(
MAC
,
"get_NCS: indx %d,format0 %d, restriced_set_config %d
\n
"
,
index
,
format0
,
restricted_set_config
);
uint16_t
get_NCS
(
uint8_t
index
,
uint16_t
format0
,
uint8_t
restricted_set_config
)
{
LOG_D
(
NR_MAC
,
"get_NCS: indx %d,format0 %d, restriced_set_config %d
\n
"
,
index
,
format0
,
restricted_set_config
);
if
(
format0
<
3
)
{
switch
(
restricted_set_config
)
{
switch
(
restricted_set_config
)
{
case
0
:
return
(
NCS_unrestricted_delta_f_RA_125
[
index
]);
case
1
:
return
(
NCS_restricted_TypeA_delta_f_RA_125
[
index
]);
case
2
:
return
(
NCS_restricted_TypeB_delta_f_RA_125
[
index
]);
default:
AssertFatal
(
1
==
0
,
"Invalid restricted set config value %d"
,
restricted_set_config
);
default:
AssertFatal
(
false
,
"Invalid restricted set config value %d"
,
restricted_set_config
);
}
}
else
{
if
(
format0
==
3
)
{
switch
(
restricted_set_config
)
{
switch
(
restricted_set_config
)
{
case
0
:
return
(
NCS_unrestricted_delta_f_RA_5
[
index
]);
case
1
:
return
(
NCS_restricted_TypeA_delta_f_RA_5
[
index
]);
case
2
:
return
(
NCS_restricted_TypeB_delta_f_RA_5
[
index
]);
default:
AssertFatal
(
1
==
0
,
"Invalid restricted set config value %d"
,
restricted_set_config
);
default:
AssertFatal
(
false
,
"Invalid restricted set config value %d"
,
restricted_set_config
);
}
}
else
...
...
This diff is collapsed.
Click to expand it.
openair2/LAYER2/NR_MAC_UE/config_ue.c
View file @
796c2a61
...
...
@@ -1399,7 +1399,7 @@ static void setup_srsconfig(NR_UE_UL_BWP_t *bwp, NR_SRS_Config_t *source, NR_SRS
}
}
static
NR_UE_DL_BWP_t
*
get_dl_bwp_structure
(
NR_UE_MAC_INST_t
*
mac
,
int
bwp_id
,
bool
setup
)
NR_UE_DL_BWP_t
*
get_dl_bwp_structure
(
NR_UE_MAC_INST_t
*
mac
,
int
bwp_id
,
bool
setup
)
{
NR_UE_DL_BWP_t
*
bwp
=
NULL
;
for
(
int
i
=
0
;
i
<
mac
->
dl_BWPs
.
count
;
i
++
)
{
...
...
@@ -1423,7 +1423,7 @@ static NR_UE_DL_BWP_t *get_dl_bwp_structure(NR_UE_MAC_INST_t *mac, int bwp_id, b
return
bwp
;
}
static
NR_UE_UL_BWP_t
*
get_ul_bwp_structure
(
NR_UE_MAC_INST_t
*
mac
,
int
bwp_id
,
bool
setup
)
NR_UE_UL_BWP_t
*
get_ul_bwp_structure
(
NR_UE_MAC_INST_t
*
mac
,
int
bwp_id
,
bool
setup
)
{
NR_UE_UL_BWP_t
*
bwp
=
NULL
;
for
(
int
i
=
0
;
i
<
mac
->
ul_BWPs
.
count
;
i
++
)
{
...
...
This diff is collapsed.
Click to expand it.
openair2/LAYER2/NR_MAC_UE/mac_defs.h
View file @
796c2a61
...
...
@@ -275,25 +275,21 @@ typedef struct {
/// PRACH format retrieved from prach_ConfigIndex
uint16_t
prach_format
;
/// Preamble Tx Counter
uint8_t
RA_PREAMBLE_TRANSMISSION_COUNTER
;
uint8_t
preamble_tx_counter
;
/// Preamble Power Ramping Counter
uint8_t
RA_PREAMBLE_POWER_RAMPING_COUNTER
;
uint8_t
preamble_power_ramping_cnt
;
/// 2-step RA power offset
int
POWER_OFFSET_2STEP_RA
;
int
power_offset_2step
;
/// Target received power at gNB. Baseline is range -202..-60 dBm. Depends on delta preamble, power ramping counter and step.
int
ra_PREAMBLE_RECEIVED_TARGET_POWER
;
/// PRACH index for TDD (0 ... 6) depending on TDD configuration and prachConfigIndex
uint8_t
ra_TDD_map_index
;
/// RA Preamble Power Ramping Step in dB
uint32_t
RA_PREAMBLE_POWER_RAMPING_STEP
;
///
uint8_t
RA_PREAMBLE_BACKOFF
;
///
uint8_t
RA_SCALING_FACTOR_BI
;
/// Indicating whether it is 2-step or 4-step RA
nr_ra_type_t
RA_TYPE
;
uint32_t
preamble_power_ramping_step
;
uint8_t
preamble_backoff
;
uint8_t
scaling_factor_bi
;
/// UE configured maximum output power
int
RA_PCMAX
;
int
Pc_max
;
}
NR_PRACH_RESOURCES_t
;
typedef
struct
{
...
...
@@ -303,7 +299,7 @@ typedef struct {
/// state of RA procedure
nrRA_UE_state_t
ra_state
;
/// RA contention type
uint8_t
cfra
;
bool
cfra
;
/// RA type
nr_ra_type_t
ra_type
;
/// RA rx frame offset: compensate RA rx offset introduced by OAI gNB.
...
...
@@ -329,7 +325,8 @@ typedef struct {
int
ra_PreambleIndex
;
// When multiple SSBs per RO is configured, this indicates which one is selected in this RO -> this is used to properly compute the PRACH preamble
uint8_t
ssb_nb_in_ro
;
int
zeroCorrelationZoneConfig
;
int
restricted_set_config
;
/// Random-access window counter
int16_t
RA_window_cnt
;
/// Flag to monitor if matching RAPID was received in RAR
...
...
This diff is collapsed.
Click to expand it.
openair2/LAYER2/NR_MAC_UE/mac_proto.h
View file @
796c2a61
...
...
@@ -45,6 +45,9 @@
\param mac MAC pointer */
void
nr_ue_init_mac
(
NR_UE_MAC_INST_t
*
mac
);
NR_UE_DL_BWP_t
*
get_dl_bwp_structure
(
NR_UE_MAC_INST_t
*
mac
,
int
bwp_id
,
bool
setup
);
NR_UE_UL_BWP_t
*
get_ul_bwp_structure
(
NR_UE_MAC_INST_t
*
mac
,
int
bwp_id
,
bool
setup
);
void
send_srb0_rrc
(
int
ue_id
,
const
uint8_t
*
sdu
,
sdu_size_t
sdu_len
,
void
*
data
);
void
update_mac_timers
(
NR_UE_MAC_INST_t
*
mac
);
NR_LC_SCHEDULING_INFO
*
get_scheduling_info_from_lcid
(
NR_UE_MAC_INST_t
*
mac
,
NR_LogicalChannelIdentity_t
lcid
);
...
...
@@ -274,6 +277,8 @@ void ul_ports_config(NR_UE_MAC_INST_t *mac,
dci_pdu_rel15_t
*
dci
,
nr_dci_format_t
dci_format
);
bool
init_RA
(
NR_UE_MAC_INST_t
*
mac
,
int
frame
);
/* Random Access */
/* \brief This function schedules the PRACH according to prach_ConfigurationIndex and TS 38.211 tables 6.3.3.2.x
and fills the PRACH PDU per each FD occasion.
...
...
This diff is collapsed.
Click to expand it.
openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
View file @
796c2a61
This diff is collapsed.
Click to expand it.
openair2/LAYER2/NR_MAC_UE/nr_ue_power_procedures.c
View file @
796c2a61
...
...
@@ -372,8 +372,8 @@ int16_t get_pucch_tx_power_ue(NR_UE_MAC_INST_t *mac,
if
(
mac
->
pucch_power_control_initialized
==
false
)
{
// Initialize power control state
// Assuming only sending on PCell
NR_PRACH_RESOURCES_t
*
prach_resourc
es
=
&
mac
->
ra
.
prach_resources
;
float
DELTA_P_rampup_requested
=
(
prach_res
ources
->
RA_PREAMBLE_POWER_RAMPING_COUNTER
-
1
)
*
prach_resources
->
RA_PREAMBLE_POWER_RAMPING_STEP
;
NR_PRACH_RESOURCES_t
*
prach_r
es
=
&
mac
->
ra
.
prach_resources
;
float
DELTA_P_rampup_requested
=
(
prach_res
->
preamble_power_ramping_cnt
-
1
)
*
prach_res
->
preamble_power_ramping_step
;
float
DELTA_P_rampup
=
P_CMAX
-
(
P_O_PUCCH
+
pathloss
+
delta_F_PUCCH
+
DELTA_TF
+
sum_delta_pucch
);
DELTA_P_rampup
=
max
(
min
(
0
,
DELTA_P_rampup
),
DELTA_P_rampup_requested
);
mac
->
G_b_f_c
=
DELTA_P_rampup
+
sum_delta_pucch
;
...
...
@@ -572,8 +572,8 @@ int get_pusch_tx_power_ue(NR_UE_MAC_INST_t *mac,
f_b_f_c
=
delta_pusch
;
}
else
{
if
(
!
mac
->
pusch_power_control_initialized
&&
is_rar_tx_retx
)
{
NR_PRACH_RESOURCES_t
*
prach_resourc
es
=
&
mac
->
ra
.
prach_resources
;
float
DELTA_P_rampup_requested
=
(
prach_res
ources
->
RA_PREAMBLE_POWER_RAMPING_COUNTER
-
1
)
*
prach_resources
->
RA_PREAMBLE_POWER_RAMPING_STEP
;
NR_PRACH_RESOURCES_t
*
prach_r
es
=
&
mac
->
ra
.
prach_resources
;
float
DELTA_P_rampup_requested
=
(
prach_res
->
preamble_power_ramping_cnt
-
1
)
*
prach_res
->
preamble_power_ramping_step
;
float
DELTA_P_rampup
=
P_CMAX
-
(
P_O_PUSCH
+
M_pusch_component
+
alpha
*
pathloss
+
DELTA_TF
+
delta_pusch
);
DELTA_P_rampup
=
min
(
DELTA_P_rampup_requested
,
max
(
0
,
DELTA_P_rampup
));
mac
->
f_b_f_c
=
DELTA_P_rampup
+
delta_pusch
;
...
...
@@ -654,9 +654,8 @@ int get_srs_tx_power_ue(NR_UE_MAC_INST_t *mac,
if
(
!
is_tpc_accumulation_provided
&&
(
!
is_configured_for_pusch_on_current_bwp
||
separate_pc_adjustment_state
))
{
if
(
!
current_UL_BWP
->
srs_power_control_initialized
)
{
NR_PRACH_RESOURCES_t
*
prach_resources
=
&
mac
->
ra
.
prach_resources
;
float
DELTA_P_rampup_requested
=
(
prach_resources
->
RA_PREAMBLE_POWER_RAMPING_COUNTER
-
1
)
*
prach_resources
->
RA_PREAMBLE_POWER_RAMPING_STEP
;
NR_PRACH_RESOURCES_t
*
prach
=
&
mac
->
ra
.
prach_resources
;
float
DELTA_P_rampup_requested
=
(
prach
->
preamble_power_ramping_cnt
-
1
)
*
prach
->
preamble_power_ramping_step
;
float
DELTA_P_rampup
=
P_CMAX
-
(
P_0_SRS
+
m_srs_component
+
alpha
*
pathloss
);
DELTA_P_rampup
=
min
(
DELTA_P_rampup_requested
,
max
(
0
,
DELTA_P_rampup
));
current_UL_BWP
->
srs_power_control_initialized
=
true
;
...
...
This diff is collapsed.
Click to expand it.
openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
View file @
796c2a61
...
...
@@ -2595,8 +2595,6 @@ static void nr_ue_prach_scheduler(NR_UE_MAC_INST_t *mac, frame_t frameP, slot_t
fapi_nr_config_request_t
*
cfg
=
&
mac
->
phy_config
.
config_req
;
fapi_nr_prach_config_t
*
prach_config
=
&
cfg
->
prach_config
;
NR_RACH_ConfigCommon_t
*
setup
=
mac
->
current_UL_BWP
->
rach_ConfigCommon
;
NR_RACH_ConfigGeneric_t
*
rach_ConfigGeneric
=
&
setup
->
rach_ConfigGeneric
;
const
int
bwp_id
=
mac
->
current_UL_BWP
->
bwp_id
;
if
(
is_ul_slot
(
slotP
,
&
mac
->
frame_structure
))
{
...
...
@@ -2627,14 +2625,13 @@ static void nr_ue_prach_scheduler(NR_UE_MAC_INST_t *mac, frame_t frameP, slot_t
LOG_E
(
NR_MAC
,
"Error in PRACH allocation
\n
"
);
return
;
}
uint16_t
ncs
=
get_NCS
(
rach_ConfigGeneric
->
zeroCorrelationZoneConfig
,
format0
,
setup
->
restrictedSetConfig
);
pdu
->
prach_config_pdu
=
(
fapi_nr_ul_config_prach_pdu
){
.
phys_cell_id
=
mac
->
physCellId
,
.
num_prach_ocas
=
1
,
.
prach_slot
=
prach_occasion_info_p
->
slot
,
.
prach_start_symbol
=
prach_occasion_info_p
->
start_symbol
,
.
num_ra
=
prach_occasion_info_p
->
fdm
,
.
num_cs
=
ncs
,
.
num_cs
=
get_NCS
(
ra
->
zeroCorrelationZoneConfig
,
format0
,
ra
->
restricted_set_config
)
,
.
root_seq_id
=
prach_config
->
num_prach_fd_occasions_list
[
prach_occasion_info_p
->
fdm
].
prach_root_sequence_index
,
.
restricted_set
=
prach_config
->
restricted_set_config
,
.
freq_msg1
=
prach_config
->
num_prach_fd_occasions_list
[
prach_occasion_info_p
->
fdm
].
k1
};
...
...
This diff is collapsed.
Click to expand it.
openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_ra_procedures.cpp
View file @
796c2a61
...
...
@@ -32,14 +32,6 @@ softmodem_params_t *get_softmodem_params(void)
void
nr_mac_rrc_ra_ind
(
const
module_id_t
mod_id
,
int
frame
,
bool
success
)
{
}
int
nr_write_ce_ulsch_pdu
(
uint8_t
*
mac_ce
,
NR_UE_MAC_INST_t
*
mac
,
NR_SINGLE_ENTRY_PHR_MAC_CE
*
power_headroom
,
const
type_bsr_t
*
bsr
,
uint8_t
*
mac_ce_end
)
{
return
0
;
}
int
nr_write_ce_msg3_pdu
(
uint8_t
*
mac_ce
,
NR_UE_MAC_INST_t
*
mac
,
rnti_t
crnti
,
uint8_t
*
mac_ce_end
)
{
return
0
;
...
...
@@ -77,6 +69,14 @@ int nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac,
{
return
0
;
}
NR_UE_DL_BWP_t
*
get_dl_bwp_structure
(
NR_UE_MAC_INST_t
*
mac
,
int
bwp_id
,
bool
setup
)
{
return
NULL
;
}
NR_UE_UL_BWP_t
*
get_ul_bwp_structure
(
NR_UE_MAC_INST_t
*
mac
,
int
bwp_id
,
bool
setup
)
{
return
NULL
;
}
}
#include <cstdio>
#include "common/utils/LOG/log.h"
...
...
@@ -84,22 +84,31 @@ int nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac,
TEST
(
test_init_ra
,
four_step_cbra
)
{
NR_UE_MAC_INST_t
mac
=
{
0
};
NR_PRACH_RESOURCES_t
prach_resources
=
{
0
}
;
RA_config_t
*
ra
=
&
mac
.
ra
;
NR_RACH_ConfigCommon_t
nr_rach_ConfigCommon
=
{
0
};
NR_RACH_ConfigGeneric_t
rach_ConfigGeneric
=
{
0
};
NR_RACH_ConfigDedicated_t
*
rach_ConfigDedicated
=
nullptr
;
NR_RACH_ConfigDedicated_t
rach_ConfigDedicated
=
{
0
}
;
NR_UE_UL_BWP_t
current_bwp
;
NR_UE_DL_BWP_t
dl_bwp
;
mac
.
current_UL_BWP
=
&
current_bwp
;
mac
.
current_DL_BWP
=
&
dl_bwp
;
long
scs
=
1
;
current_bwp
.
scs
=
scs
;
current_bwp
.
bwp_id
=
0
;
dl_bwp
.
bwp_id
=
0
;
current_bwp
.
channel_bandwidth
=
40
;
nr_rach_ConfigCommon
.
msg1_SubcarrierSpacing
=
&
scs
;
nr_rach_ConfigCommon
.
rach_ConfigGeneric
=
rach_ConfigGeneric
;
current_bwp
.
rach_ConfigCommon
=
&
nr_rach_ConfigCommon
;
ra
->
rach_ConfigDedicated
=
&
rach_ConfigDedicated
;
mac
.
p_Max
=
23
;
mac
.
nr_band
=
78
;
mac
.
frame_structure
.
frame_type
=
TDD
;
mac
.
frequency_range
=
FR1
;
mac
.
first_sync_frame
=
0
;
int
frame
=
151
;
init_RA
(
&
mac
,
&
prach_resources
,
&
nr_rach_ConfigCommon
,
&
rach_ConfigGeneric
,
rach_ConfigDedicated
);
init_RA
(
&
mac
,
frame
);
EXPECT_EQ
(
mac
.
ra
.
ra_type
,
RA_4_STEP
);
EXPECT_EQ
(
mac
.
state
,
UE_PERFORMING_RA
);
...
...
@@ -110,25 +119,34 @@ TEST(test_init_ra, four_step_cbra)
TEST
(
test_init_ra
,
four_step_cfra
)
{
NR_UE_MAC_INST_t
mac
=
{
0
};
NR_PRACH_RESOURCES_t
prach_resources
=
{
0
}
;
RA_config_t
*
ra
=
&
mac
.
ra
;
NR_RACH_ConfigCommon_t
nr_rach_ConfigCommon
=
{
0
};
NR_RACH_ConfigGeneric_t
rach_ConfigGeneric
=
{
0
};
NR_UE_UL_BWP_t
current_bwp
;
NR_UE_DL_BWP_t
dl_bwp
;
mac
.
current_UL_BWP
=
&
current_bwp
;
mac
.
current_DL_BWP
=
&
dl_bwp
;
long
scs
=
1
;
current_bwp
.
scs
=
scs
;
current_bwp
.
bwp_id
=
0
;
dl_bwp
.
bwp_id
=
0
;
current_bwp
.
channel_bandwidth
=
40
;
nr_rach_ConfigCommon
.
msg1_SubcarrierSpacing
=
&
scs
;
nr_rach_ConfigCommon
.
rach_ConfigGeneric
=
rach_ConfigGeneric
;
current_bwp
.
rach_ConfigCommon
=
&
nr_rach_ConfigCommon
;
mac
.
p_Max
=
23
;
mac
.
nr_band
=
78
;
mac
.
frame_structure
.
frame_type
=
TDD
;
mac
.
frequency_range
=
FR1
;
mac
.
first_sync_frame
=
0
;
int
frame
=
151
;
NR_RACH_ConfigDedicated_t
rach_ConfigDedicated
=
{
0
};
struct
NR_CFRA
cfra
;
rach_ConfigDedicated
.
cfra
=
&
cfra
;
ra
->
rach_ConfigDedicated
=
&
rach_ConfigDedicated
;
init_RA
(
&
mac
,
&
prach_resources
,
&
nr_rach_ConfigCommon
,
&
rach_ConfigGeneric
,
&
rach_ConfigDedicated
);
init_RA
(
&
mac
,
frame
);
EXPECT_EQ
(
mac
.
ra
.
ra_type
,
RA_4_STEP
);
EXPECT_EQ
(
mac
.
state
,
UE_PERFORMING_RA
);
...
...
This diff is collapsed.
Click to expand it.
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