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
e958822a
Commit
e958822a
authored
Dec 04, 2024
by
francescomani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Procedures for Contention Resolution
parent
cc154da5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
79 deletions
+40
-79
openair2/LAYER2/NR_MAC_UE/mac_proto.h
openair2/LAYER2/NR_MAC_UE/mac_proto.h
+2
-5
openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
+28
-65
openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
+7
-8
openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
+3
-1
No files found.
openair2/LAYER2/NR_MAC_UE/mac_proto.h
View file @
e958822a
...
...
@@ -300,12 +300,9 @@ void configure_csi_resource_mapping(fapi_nr_dl_config_csirs_pdu_rel15_t *csirs_c
*/
void
nr_ue_msg3_scheduler
(
NR_UE_MAC_INST_t
*
mac
,
frame_t
current_frame
,
slot_t
current_slot
,
uint8_t
Msg3_tda_id
);
void
nr_ue_contention_resolution
(
NR_UE_MAC_INST_t
*
mac
,
int
cc_id
,
frame_t
frame
,
int
slot
,
NR_PRACH_RESOURCES_t
*
prach_resources
);
void
nr_ra_failed
(
NR_UE_MAC_INST_t
*
mac
,
uint8_t
CC_id
,
NR_PRACH_RESOURCES_t
*
prach_resources
,
frame_t
frame
,
int
slot
);
void
nr_ra_contention_resolution_failed
(
RA_config_t
*
ra
);
void
nr_ra_succeeded
(
NR_UE_MAC_INST_t
*
mac
,
const
uint8_t
gNB_index
,
const
frame_t
frame
,
const
int
slot
);
void
nr_ra_backoff_setting
(
RA_config_t
*
ra
);
void
nr_get_RA_window
(
NR_UE_MAC_INST_t
*
mac
);
/*@mac pointer to MAC instance
...
...
openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
View file @
e958822a
...
...
@@ -1174,8 +1174,6 @@ void nr_get_Msg3_MsgA_PUSCH_payload(NR_UE_MAC_INST_t *mac, uint8_t *buf, int TBS
void
nr_ue_manage_ra_procedure
(
NR_UE_MAC_INST_t
*
mac
,
int
CC_id
,
frame_t
frame
,
uint8_t
gNB_id
,
int
nr_slot_tx
)
{
RA_config_t
*
ra
=
&
mac
->
ra
;
NR_PRACH_RESOURCES_t
*
prach_resources
=
&
ra
->
prach_resources
;
if
(
ra
->
ra_state
==
nrRA_UE_IDLE
)
{
bool
init_success
=
init_RA
(
mac
,
frame
);
if
(
!
init_success
)
...
...
@@ -1199,30 +1197,6 @@ void nr_ue_manage_ra_procedure(NR_UE_MAC_INST_t *mac, int CC_id, frame_t frame,
ra_resource_selection
(
mac
);
}
}
if
(
nr_timer_is_active
(
&
ra
->
contention_resolution_timer
))
{
nr_ue_contention_resolution
(
mac
,
CC_id
,
frame
,
nr_slot_tx
,
prach_resources
);
}
}
////////////////////////////////////////////////////////////////////////////
/////////* Random Access Contention Resolution (5.1.35 TS 38.321) */////////
////////////////////////////////////////////////////////////////////////////
// Handling contention resolution timer
// WIP todo:
// - beam failure recovery
// - RA completed
void
nr_ue_contention_resolution
(
NR_UE_MAC_INST_t
*
mac
,
int
cc_id
,
frame_t
frame
,
int
slot
,
NR_PRACH_RESOURCES_t
*
prach_resources
)
{
RA_config_t
*
ra
=
&
mac
->
ra
;
if
(
nr_timer_expired
(
&
ra
->
contention_resolution_timer
))
{
ra
->
t_crnti
=
0
;
nr_timer_stop
(
&
ra
->
contention_resolution_timer
);
// Signal PHY to quit RA procedure
LOG_E
(
MAC
,
"[UE %d] 4-Step CBRA: Contention resolution timer has expired, RA procedure has failed...
\n
"
,
mac
->
ue_id
);
nr_ra_failed
(
mac
,
cc_id
,
prach_resources
,
frame
,
slot
);
}
}
// Handlig successful RA completion @ MAC layer
...
...
@@ -1250,7 +1224,6 @@ void nr_ra_succeeded(NR_UE_MAC_INST_t *mac, const uint8_t gNB_index, const frame
mac
->
ue_id
,
frame
,
slot
);
nr_timer_stop
(
&
ra
->
contention_resolution_timer
);
mac
->
crnti
=
ra
->
t_crnti
;
ra
->
t_crnti
=
0
;
LOG_D
(
MAC
,
"[UE %d][%d.%d] CBRA: cleared contention resolution timer...
\n
"
,
mac
->
ue_id
,
frame
,
slot
);
...
...
@@ -1264,6 +1237,33 @@ void nr_ra_succeeded(NR_UE_MAC_INST_t *mac, const uint8_t gNB_index, const frame
nr_mac_rrc_ra_ind
(
mac
->
ue_id
,
frame
,
true
);
}
void
nr_ra_backoff_setting
(
RA_config_t
*
ra
)
{
// select a random backoff time according to a uniform distribution
// between 0 and the PREAMBLE_BACKOFF
uint32_t
seed
=
(
unsigned
int
)(
rdtsc_oai
()
&
~
0
);
uint32_t
random_backoff
=
ra
->
RA_backoff_limit
?
rand_r
(
&
seed
)
%
ra
->
RA_backoff_limit
:
0
;
// in slots
nr_timer_setup
(
&
ra
->
RA_backoff_timer
,
random_backoff
,
1
);
nr_timer_start
(
&
ra
->
RA_backoff_timer
);
}
void
nr_ra_contention_resolution_failed
(
RA_config_t
*
ra
)
{
// discard the TEMPORARY_C-RNTI
ra
->
t_crnti
=
0
;
// flush MSG3 buffer
free_and_zero
(
ra
->
Msg3_buffer
);
NR_PRACH_RESOURCES_t
*
prach_resources
=
&
ra
->
prach_resources
;
prach_resources
->
preamble_tx_counter
++
;
if
(
prach_resources
->
preamble_tx_counter
==
ra
->
preambleTransMax
+
1
)
{
// TODO indicate a Random Access problem to upper layers
}
else
{
// TODO handle msgA-TransMax (go back to 4-step if the threshold is reached)
// starting backoff time
nr_ra_backoff_setting
(
ra
);
}
}
void
nr_rar_not_successful
(
NR_UE_MAC_INST_t
*
mac
)
{
LOG_W
(
MAC
,
"[UE %d] RAR reception failed
\n
"
,
mac
->
ue_id
);
...
...
@@ -1284,44 +1284,7 @@ void nr_rar_not_successful(NR_UE_MAC_INST_t *mac)
}
}
if
(
!
ra_completed
)
{
// select a random backoff time according to a uniform distribution
// between 0 and the PREAMBLE_BACKOFF
uint32_t
seed
=
(
unsigned
int
)(
rdtsc_oai
()
&
~
0
);
uint32_t
random_backoff
=
rand_r
(
&
seed
)
%
ra
->
RA_backoff_limit
;
// in slots
nr_timer_setup
(
&
ra
->
RA_backoff_timer
,
random_backoff
,
1
);
nr_timer_start
(
&
ra
->
RA_backoff_timer
);
}
}
// Handling failure of RA procedure @ MAC layer
// according to section 5 of 3GPP TS 38.321 version 16.2.1 Release 16
// todo:
// - complete handling of received contention-based RA preamble
void
nr_ra_failed
(
NR_UE_MAC_INST_t
*
mac
,
uint8_t
CC_id
,
NR_PRACH_RESOURCES_t
*
prach_resources
,
frame_t
frame
,
int
slot
)
{
RA_config_t
*
ra
=
&
mac
->
ra
;
ra
->
ra_PreambleIndex
=
-
1
;
ra
->
ra_state
=
nrRA_UE_IDLE
;
prach_resources
->
preamble_tx_counter
++
;
// when the Contention Resolution is considered not successful
// stop timeAlignmentTimer
nr_timer_stop
(
&
mac
->
time_alignment_timer
);
if
(
prach_resources
->
preamble_tx_counter
==
ra
->
preambleTransMax
+
1
)
{
LOG_D
(
NR_MAC
,
"[UE %d][%d.%d] Maximum number of RACH attempts (%d) reached, selecting backoff time...
\n
"
,
mac
->
ue_id
,
frame
,
slot
,
ra
->
preambleTransMax
);
prach_resources
->
preamble_tx_counter
=
1
;
prach_resources
->
preamble_power_ramping_step
+=
2
;
// 2 dB increment
prach_resources
->
ra_preamble_rx_target_power
=
get_ra_preamble_rx_target_power
(
ra
,
mac
->
current_UL_BWP
->
scs
);
nr_ra_backoff_setting
(
ra
);
}
}
...
...
openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
View file @
e958822a
...
...
@@ -3501,9 +3501,7 @@ static int nr_ue_validate_successrar(uint8_t *pduP,
nr_timer_stop
(
&
ra
->
response_window_timer
);
nr_ra_succeeded
(
mac
,
gNB_index
,
frameP
,
slot
);
}
else
if
(
!
ra_success
)
{
// nr_ra_failed(mac, CC_id, &ra->prach_resources, frameP, slot);
ra
->
ra_state
=
nrRA_UE_IDLE
;
ra
->
RA_active
=
0
;
nr_ra_backoff_setting
(
ra
);
}
}
}
else
{
// RAPID
...
...
@@ -3706,7 +3704,8 @@ void nr_ue_process_mac_pdu(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *dl_i
mac_len
=
6
;
if
(
ra
->
ra_state
==
nrRA_WAIT_CONTENTION_RESOLUTION
)
{
LOG_I
(
MAC
,
"[UE %d]Frame %d Contention resolution identity: 0x%02x%02x%02x%02x%02x%02x Terminating RA procedure
\n
"
,
LOG_D
(
NR_MAC
,
"[UE %d]Frame %d Contention resolution identity: 0x%02x%02x%02x%02x%02x%02x Terminating RA procedure
\n
"
,
mac
->
ue_id
,
frameP
,
pduP
[
1
],
...
...
@@ -3716,15 +3715,15 @@ void nr_ue_process_mac_pdu(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *dl_i
pduP
[
5
],
pduP
[
6
]);
nr_timer_stop
(
&
ra
->
contention_resolution_timer
);
bool
ra_success
=
check_ra_contention_resolution
(
&
pduP
[
1
],
ra
->
cont_res_id
);
if
(
ra
->
RA_active
&&
ra_success
)
{
nr_ra_succeeded
(
mac
,
gNB_index
,
frameP
,
slot
);
}
else
if
(
!
ra_success
)
{
// TODO: Handle failure of RA procedure @ MAC layer
// nr_ra_failed(module_idP, CC_id, prach_resources, frameP, slot); // prach_resources is a PHY structure
ra
->
ra_state
=
nrRA_UE_IDLE
;
ra
->
RA_active
=
false
;
// consider this Contention Resolution not successful and discard the successfully decoded MAC PDU
nr_ra_contention_resolution_failed
(
ra
);
return
;
}
}
break
;
...
...
openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
View file @
e958822a
...
...
@@ -192,7 +192,9 @@ void update_mac_timers(NR_UE_MAC_INST_t *mac)
bool
alignment_timer_expired
=
nr_timer_tick
(
&
mac
->
time_alignment_timer
);
if
(
alignment_timer_expired
)
handle_time_alignment_timer_expired
(
mac
);
nr_timer_tick
(
&
mac
->
ra
.
contention_resolution_timer
);
bool
contention_resolution_expired
=
nr_timer_tick
(
&
mac
->
ra
.
contention_resolution_timer
);
if
(
contention_resolution_expired
)
nr_ra_contention_resolution_failed
(
&
mac
->
ra
);
for
(
int
j
=
0
;
j
<
NR_MAX_SR_ID
;
j
++
)
nr_timer_tick
(
&
mac
->
scheduling_info
.
sr_info
[
j
].
prohibitTimer
);
nr_timer_tick
(
&
mac
->
scheduling_info
.
sr_DelayTimer
);
...
...
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