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
lizhongxiao
OpenXG-RAN
Commits
0224cb8a
Commit
0224cb8a
authored
Dec 13, 2023
by
francescomani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tick for MAC timers (applied to RA contention resolution)
parent
513f060f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
43 additions
and
33 deletions
+43
-33
executables/nr-ue.c
executables/nr-ue.c
+6
-3
openair2/LAYER2/NR_MAC_UE/mac_defs.h
openair2/LAYER2/NR_MAC_UE/mac_defs.h
+2
-4
openair2/LAYER2/NR_MAC_UE/mac_proto.h
openair2/LAYER2/NR_MAC_UE/mac_proto.h
+1
-0
openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
+18
-26
openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
+5
-0
openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c
openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c
+9
-0
openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h
openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h
+2
-0
No files found.
executables/nr-ue.c
View file @
0224cb8a
...
@@ -533,20 +533,23 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD) {
...
@@ -533,20 +533,23 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD) {
}
}
void
processSlotTX
(
void
*
arg
)
{
void
processSlotTX
(
void
*
arg
)
{
nr_rxtx_thread_data_t
*
rxtxD
=
(
nr_rxtx_thread_data_t
*
)
arg
;
nr_rxtx_thread_data_t
*
rxtxD
=
(
nr_rxtx_thread_data_t
*
)
arg
;
const
UE_nr_rxtx_proc_t
*
proc
=
&
rxtxD
->
proc
;
const
UE_nr_rxtx_proc_t
*
proc
=
&
rxtxD
->
proc
;
PHY_VARS_NR_UE
*
UE
=
rxtxD
->
UE
;
PHY_VARS_NR_UE
*
UE
=
rxtxD
->
UE
;
nr_phy_data_tx_t
phy_data
=
{
0
};
nr_phy_data_tx_t
phy_data
=
{
0
};
if
(
UE
->
if_inst
)
UE
->
if_inst
->
slot_indication
(
UE
->
Mod_id
);
LOG_D
(
PHY
,
LOG_D
(
PHY
,
"SlotTx %d.%d => slot type %d, wait: %d
\n
"
,
"SlotTx %d.%d => slot type %d, wait: %d
\n
"
,
proc
->
frame_tx
,
proc
->
frame_tx
,
proc
->
nr_slot_tx
,
proc
->
nr_slot_tx
,
proc
->
tx_slot_type
,
proc
->
tx_slot_type
,
rxtxD
->
tx_wait_for_dlsch
);
rxtxD
->
tx_wait_for_dlsch
);
if
(
proc
->
tx_slot_type
==
NR_UPLINK_SLOT
||
proc
->
tx_slot_type
==
NR_MIXED_SLOT
){
if
(
proc
->
tx_slot_type
==
NR_UPLINK_SLOT
||
proc
->
tx_slot_type
==
NR_MIXED_SLOT
)
{
if
(
rxtxD
->
tx_wait_for_dlsch
)
if
(
rxtxD
->
tx_wait_for_dlsch
)
LOG_D
(
PHY
,
"enter wait for tx, slot %d, nb events to wait %d; "
,
proc
->
nr_slot_tx
,
rxtxD
->
tx_wait_for_dlsch
);
LOG_D
(
PHY
,
"enter wait for tx, slot %d, nb events to wait %d; "
,
proc
->
nr_slot_tx
,
rxtxD
->
tx_wait_for_dlsch
);
// wait for rx slots to send indication (if any) that DLSCH decoding is finished
// wait for rx slots to send indication (if any) that DLSCH decoding is finished
...
...
openair2/LAYER2/NR_MAC_UE/mac_defs.h
View file @
0224cb8a
...
@@ -321,10 +321,8 @@ typedef struct {
...
@@ -321,10 +321,8 @@ typedef struct {
/// RA Msg3 size in bytes
/// RA Msg3 size in bytes
uint8_t
Msg3_size
;
uint8_t
Msg3_size
;
/// Random-access Contention Resolution Timer active flag
/// Random-access Contention Resolution Timer
uint8_t
RA_contention_resolution_timer_active
;
NR_timer_t
contention_resolution_timer
;
int
RA_contention_resolution_target_frame
;
int
RA_contention_resolution_target_slot
;
/// Transmitted UE Contention Resolution Identifier
/// Transmitted UE Contention Resolution Identifier
uint8_t
cont_res_id
[
6
];
uint8_t
cont_res_id
[
6
];
...
...
openair2/LAYER2/NR_MAC_UE/mac_proto.h
View file @
0224cb8a
...
@@ -150,6 +150,7 @@
...
@@ -150,6 +150,7 @@
void
nr_ue_init_mac
(
module_id_t
module_idP
);
void
nr_ue_init_mac
(
module_id_t
module_idP
);
void
send_srb0_rrc
(
int
ue_id
,
const
uint8_t
*
sdu
,
sdu_size_t
sdu_len
,
void
*
data
);
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
);
/**\brief apply default configuration values in nr_mac instance
/**\brief apply default configuration values in nr_mac instance
\param mac mac instance */
\param mac mac instance */
...
...
openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
View file @
0224cb8a
...
@@ -587,24 +587,20 @@ void nr_Msg1_transmitted(module_id_t mod_id){
...
@@ -587,24 +587,20 @@ void nr_Msg1_transmitted(module_id_t mod_id){
ra
->
RA_attempt_number
++
;
ra
->
RA_attempt_number
++
;
}
}
void
nr_Msg3_transmitted
(
module_id_t
mod_id
,
uint8_t
CC_id
,
frame_t
frameP
,
slot_t
slotP
,
uint8_t
gNB_id
)
{
void
nr_Msg3_transmitted
(
module_id_t
mod_id
,
uint8_t
CC_id
,
frame_t
frameP
,
slot_t
slotP
,
uint8_t
gNB_id
)
{
NR_UE_MAC_INST_t
*
mac
=
get_mac_inst
(
mod_id
);
NR_UE_MAC_INST_t
*
mac
=
get_mac_inst
(
mod_id
);
RA_config_t
*
ra
=
&
mac
->
ra
;
RA_config_t
*
ra
=
&
mac
->
ra
;
NR_RACH_ConfigCommon_t
*
nr_rach_ConfigCommon
=
mac
->
current_UL_BWP
->
rach_ConfigCommon
;
NR_RACH_ConfigCommon_t
*
nr_rach_ConfigCommon
=
mac
->
current_UL_BWP
->
rach_ConfigCommon
;
long
mu
=
mac
->
current_UL_BWP
->
scs
;
long
mu
=
mac
->
current_UL_BWP
->
scs
;
int
subframes_per_slot
=
nr_slots_per_frame
[
mu
]
/
10
;
int
subframes_per_slot
=
nr_slots_per_frame
[
mu
]
/
10
;
// start contention resolution timer (cnt in slots)
int
RA_contention_resolution_timer_subframes
=
(
nr_rach_ConfigCommon
->
ra_ContentionResolutionTimer
+
1
)
<<
3
;
ra
->
RA_contention_resolution_target_frame
=
(
frameP
+
(
RA_contention_resolution_timer_subframes
/
10
))
%
MAX_FRAME_NUMBER
;
ra
->
RA_contention_resolution_target_slot
=
(
slotP
+
(
RA_contention_resolution_timer_subframes
*
subframes_per_slot
))
%
nr_slots_per_frame
[
mu
];
LOG_D
(
MAC
,
"In %s: [UE %d] CB-RA: contention resolution timer set in frame.slot %d.%d and expiring in %d.%d
\n
"
,
// start contention resolution timer
__FUNCTION__
,
mod_id
,
frameP
,
slotP
,
ra
->
RA_contention_resolution_target_frame
,
ra
->
RA_contention_resolution_target_slot
);
int
RA_contention_resolution_timer_subframes
=
(
nr_rach_ConfigCommon
->
ra_ContentionResolutionTimer
+
1
)
<<
3
;
// timer step 1 slot and timer target given by ra_ContentionResolutionTimer
nr_timer_setup
(
&
ra
->
contention_resolution_timer
,
RA_contention_resolution_timer_subframes
*
subframes_per_slot
,
1
);
nr_timer_start
(
&
ra
->
contention_resolution_timer
);
ra
->
RA_contention_resolution_timer_active
=
1
;
ra
->
ra_state
=
WAIT_CONTENTION_RESOLUTION
;
ra
->
ra_state
=
WAIT_CONTENTION_RESOLUTION
;
}
}
...
@@ -804,7 +800,7 @@ uint8_t nr_ue_get_rach(module_id_t mod_id,
...
@@ -804,7 +800,7 @@ uint8_t nr_ue_get_rach(module_id_t mod_id,
}
}
}
}
if
(
ra
->
RA_contention_resolution_timer_active
)
{
if
(
is_nr_timer_active
(
ra
->
contention_resolution_timer
)
)
{
nr_ue_contention_resolution
(
mod_id
,
CC_id
,
frame
,
nr_slot_tx
,
prach_resources
);
nr_ue_contention_resolution
(
mod_id
,
CC_id
,
frame
,
nr_slot_tx
,
prach_resources
);
}
}
...
@@ -858,21 +854,17 @@ void nr_get_RA_window(NR_UE_MAC_INST_t *mac)
...
@@ -858,21 +854,17 @@ void nr_get_RA_window(NR_UE_MAC_INST_t *mac)
// WIP todo:
// WIP todo:
// - beam failure recovery
// - beam failure recovery
// - RA completed
// - RA completed
void
nr_ue_contention_resolution
(
module_id_t
module_id
,
int
cc_id
,
frame_t
frame
,
int
slot
,
NR_PRACH_RESOURCES_t
*
prach_resources
)
{
void
nr_ue_contention_resolution
(
module_id_t
module_id
,
int
cc_id
,
frame_t
frame
,
int
slot
,
NR_PRACH_RESOURCES_t
*
prach_resources
)
{
NR_UE_MAC_INST_t
*
mac
=
get_mac_inst
(
module_id
);
NR_UE_MAC_INST_t
*
mac
=
get_mac_inst
(
module_id
);
RA_config_t
*
ra
=
&
mac
->
ra
;
RA_config_t
*
ra
=
&
mac
->
ra
;
if
(
ra
->
RA_contention_resolution_timer_active
==
1
)
{
if
(
nr_timer_expired
(
ra
->
contention_resolution_timer
))
{
if
(
frame
>=
ra
->
RA_contention_resolution_target_frame
&&
ra
->
t_crnti
=
0
;
slot
>=
ra
->
RA_contention_resolution_target_slot
)
{
nr_timer_stop
(
&
ra
->
contention_resolution_timer
);
ra
->
t_crnti
=
0
;
// Signal PHY to quit RA procedure
ra
->
RA_active
=
0
;
LOG_E
(
MAC
,
"[UE %d] CB-RA: Contention resolution timer has expired, RA procedure has failed...
\n
"
,
module_id
);
ra
->
RA_contention_resolution_timer_active
=
0
;
nr_ra_failed
(
module_id
,
cc_id
,
prach_resources
,
frame
,
slot
);
// Signal PHY to quit RA procedure
LOG_E
(
MAC
,
"[UE %d] CB-RA: Contention resolution timer has expired, RA procedure has failed...
\n
"
,
module_id
);
nr_ra_failed
(
module_id
,
cc_id
,
prach_resources
,
frame
,
slot
);
}
}
}
}
}
...
@@ -890,7 +882,7 @@ void nr_ra_succeeded(const module_id_t mod_id, const uint8_t gNB_index, const fr
...
@@ -890,7 +882,7 @@ void nr_ra_succeeded(const module_id_t mod_id, const uint8_t gNB_index, const fr
ra
->
RA_window_cnt
=
-
1
;
ra
->
RA_window_cnt
=
-
1
;
}
else
{
}
else
{
LOG_A
(
MAC
,
"[UE %d][%d.%d][RAPROC] RA procedure succeeded. CB-RA: Contention Resolution is successful.
\n
"
,
mod_id
,
frame
,
slot
);
LOG_A
(
MAC
,
"[UE %d][%d.%d][RAPROC] RA procedure succeeded. CB-RA: Contention Resolution is successful.
\n
"
,
mod_id
,
frame
,
slot
);
ra
->
RA_contention_resolution_timer_active
=
0
;
nr_timer_stop
(
&
ra
->
contention_resolution_timer
)
;
mac
->
crnti
=
ra
->
t_crnti
;
mac
->
crnti
=
ra
->
t_crnti
;
ra
->
t_crnti
=
0
;
ra
->
t_crnti
=
0
;
LOG_D
(
MAC
,
"In %s: [UE %d][%d.%d] CB-RA: cleared contention resolution timer...
\n
"
,
__FUNCTION__
,
mod_id
,
frame
,
slot
);
LOG_D
(
MAC
,
"In %s: [UE %d][%d.%d] CB-RA: cleared contention resolution timer...
\n
"
,
__FUNCTION__
,
mod_id
,
frame
,
slot
);
...
...
openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
View file @
0224cb8a
...
@@ -90,6 +90,11 @@ fapi_nr_ul_config_request_pdu_t *lockGet_ul_config(NR_UE_MAC_INST_t *mac, frame_
...
@@ -90,6 +90,11 @@ fapi_nr_ul_config_request_pdu_t *lockGet_ul_config(NR_UE_MAC_INST_t *mac, frame_
return
pdu
;
return
pdu
;
}
}
void
update_mac_timers
(
NR_UE_MAC_INST_t
*
mac
)
{
nr_timer_tick
(
&
mac
->
ra
.
contention_resolution_timer
);
}
void
remove_ul_config_last_item
(
fapi_nr_ul_config_request_pdu_t
*
pdu
)
void
remove_ul_config_last_item
(
fapi_nr_ul_config_request_pdu_t
*
pdu
)
{
{
pdu
->
privateNBpdus
--
;
pdu
->
privateNBpdus
--
;
...
...
openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c
View file @
0224cb8a
...
@@ -1277,6 +1277,14 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info)
...
@@ -1277,6 +1277,14 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info)
return
ret2
;
return
ret2
;
}
}
void
nr_ue_slot_indication
(
uint8_t
mod_id
)
{
pthread_mutex_lock
(
&
mac_IF_mutex
);
NR_UE_MAC_INST_t
*
mac
=
get_mac_inst
(
mod_id
);
update_mac_timers
(
mac
);
pthread_mutex_unlock
(
&
mac_IF_mutex
);
}
nr_ue_if_module_t
*
nr_ue_if_module_init
(
uint32_t
module_id
)
nr_ue_if_module_t
*
nr_ue_if_module_init
(
uint32_t
module_id
)
{
{
if
(
nr_ue_if_module_inst
[
module_id
]
==
NULL
)
{
if
(
nr_ue_if_module_inst
[
module_id
]
==
NULL
)
{
...
@@ -1294,6 +1302,7 @@ nr_ue_if_module_t *nr_ue_if_module_init(uint32_t module_id)
...
@@ -1294,6 +1302,7 @@ nr_ue_if_module_t *nr_ue_if_module_init(uint32_t module_id)
nr_ue_if_module_inst
[
module_id
]
->
scheduled_response
=
nr_ue_scheduled_response
;
nr_ue_if_module_inst
[
module_id
]
->
scheduled_response
=
nr_ue_scheduled_response
;
nr_ue_if_module_inst
[
module_id
]
->
dl_indication
=
nr_ue_dl_indication
;
nr_ue_if_module_inst
[
module_id
]
->
dl_indication
=
nr_ue_dl_indication
;
nr_ue_if_module_inst
[
module_id
]
->
ul_indication
=
nr_ue_ul_indication
;
nr_ue_if_module_inst
[
module_id
]
->
ul_indication
=
nr_ue_ul_indication
;
nr_ue_if_module_inst
[
module_id
]
->
slot_indication
=
nr_ue_slot_indication
;
}
}
pthread_mutex_init
(
&
mac_IF_mutex
,
NULL
);
pthread_mutex_init
(
&
mac_IF_mutex
,
NULL
);
...
...
openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h
View file @
0224cb8a
...
@@ -245,6 +245,7 @@ typedef int (nr_ue_dl_indication_f)(nr_downlink_indication_t *dl_info);
...
@@ -245,6 +245,7 @@ typedef int (nr_ue_dl_indication_f)(nr_downlink_indication_t *dl_info);
*/
*/
typedef
int
(
nr_ue_ul_indication_f
)(
nr_uplink_indication_t
*
ul_info
);
typedef
int
(
nr_ue_ul_indication_f
)(
nr_uplink_indication_t
*
ul_info
);
typedef
void
(
nr_ue_slot_indication_f
)(
uint8_t
mod_id
);
/*
/*
* Generic type of an application-defined callback to return various
* Generic type of an application-defined callback to return various
...
@@ -263,6 +264,7 @@ typedef struct nr_ue_if_module_s {
...
@@ -263,6 +264,7 @@ typedef struct nr_ue_if_module_s {
nr_ue_dl_indication_f
*
dl_indication
;
nr_ue_dl_indication_f
*
dl_indication
;
nr_ue_ul_indication_f
*
ul_indication
;
nr_ue_ul_indication_f
*
ul_indication
;
nr_ue_sl_indication_f
*
sl_indication
;
nr_ue_sl_indication_f
*
sl_indication
;
nr_ue_slot_indication_f
*
slot_indication
;
uint32_t
cc_mask
;
uint32_t
cc_mask
;
uint32_t
current_frame
;
uint32_t
current_frame
;
uint32_t
current_slot
;
uint32_t
current_slot
;
...
...
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