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
1f4b5520
Commit
1f4b5520
authored
3 years ago
by
Melissa Elkadi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revering nr_ue_get_rach() to complete CFRA
parent
2ac8d4b6
Branches unavailable
2024.w06
2024.w05
2024.w04
2024.w03
2024.w02
2024.w01
2023.w51
2023.w50
2023.w49
2023.w48
2023.w47
2023.w45
2023.w43
2023.w42
2023.w41
2023.w40
2023.w39
2023.w38
2023.w37
2023.w36
2023.w34
2023.w33
2023.w32
2023.w31
2023.w30
2023.w29
2023.w28
2023.w27
2023.w26
2023.w25
2023.w24
2023.w23
2023.w22
2023.w21
2023.w20
2023.w19
2023.w18
2023.w18b
2023.w16
2023.w15
2023.w14
2023.w13
2023.w12
2023.w11
2023.w11b
2023.w10
2023.w10b
2023.w09
2023.w08
2023.w08b
2023.w07
2023.w06
2023.w05
2023.w03
2023.w02
2022.42
2022.41
2022.w51
2022.w50
2022.w49
2022.w48
2022.w47
2022.w46
2022.w45
2022.w43
2022.w42
2022.w42b
2022.w41
2022.w40
2022.w39
2022.w38
2022.w37
2022.w37b
2022.w36
2022.w35
2022.w33
2022.w32
2022.w31
2022.w31b
2022.w30
2022.w29
2022.w26
2022.w25
2022.w24
2022.w24b
2022.w23
2022.w22
2022.w21
2022.w20
2022.w19
2022.w18
2022.w17
2022.w15
2022.w15b
2022.w14a
2022.w13
2022.w13b
2022.w13a
2022.w12
2022.w10
2022.w09
2022.w09b
2022.w08
2022.w08b
2022.w07
2022.w07b
2022.w06
2022.w06a
2022.w05
2022.w05b
2022.w03_hotfix
2022.w03_b
2022.w02
2022.w01
v2.1.0
v2.0.0
setparam
flexran-eol
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
76 deletions
+54
-76
openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
+54
-76
No files found.
openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
View file @
1f4b5520
...
...
@@ -542,6 +542,11 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
NR_UE_MAC_INST_t
*
mac
=
get_mac_inst
(
mod_id
);
RA_config_t
*
ra
=
&
mac
->
ra
;
uint8_t
mac_sdus
[
MAX_NR_ULSCH_PAYLOAD_BYTES
];
uint8_t
lcid
=
UL_SCH_LCID_CCCH
;
uint8_t
*
payload
;
uint16_t
size_sdu
=
0
;
unsigned
short
post_padding
;
NR_RACH_ConfigCommon_t
*
setup
;
if
(
mac
->
scc
)
setup
=
mac
->
scc
->
uplinkConfigCommon
->
initialUplinkBWP
->
rach_ConfigCommon
->
choice
.
setup
;
else
setup
=
mac
->
scc_SIB
->
uplinkConfigCommon
->
initialUplinkBWP
.
rach_ConfigCommon
->
choice
.
setup
;
...
...
@@ -549,6 +554,14 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
NR_RACH_ConfigGeneric_t
*
rach_ConfigGeneric
=
&
setup
->
rach_ConfigGeneric
;
NR_RACH_ConfigDedicated_t
*
rach_ConfigDedicated
=
ra
->
rach_ConfigDedicated
;
uint8_t
sdu_lcids
[
NB_RB_MAX
]
=
{
0
};
uint16_t
sdu_lengths
[
NB_RB_MAX
]
=
{
0
};
int
num_sdus
=
0
;
int
offset
=
0
;
int
TBS_bytes
=
848
;
int
header_length_total
=
0
;
int
mac_ce_len
;
// Delay init RA procedure to allow the convergence of the IIR filter on PRACH noise measurements at gNB side
if
(
!
prach_resources
->
init_msg1
)
{
if
(
(
mac
->
common_configuration_complete
>
0
||
get_softmodem_params
()
->
do_ra
==
1
||
get_softmodem_params
()
->
nsa
)
&&
...
...
@@ -560,106 +573,71 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
}
}
LOG_D
(
NR_MAC
,
"In %s: [UE %d][%d.%d]: init_msg1 %d, ra_state %d, RA_active %d
\n
"
,
__FUNCTION__
,
mod_id
,
frame
,
nr_slot_tx
,
prach_resources
->
init_msg1
,
ra
->
ra_state
,
ra
->
RA_active
);
LOG_D
(
NR_MAC
,
"frame %d prach_resources->init_msg1 %d, ra->ra_state %d, ra->RA_active %d
\n
"
,
frame
,
prach_resources
->
init_msg1
,
ra
->
ra_state
,
ra
->
RA_active
);
if
(
prach_resources
->
init_msg1
&&
ra
->
ra_state
!=
RA_SUCCEEDED
)
{
if
(
ra
->
RA_active
==
0
)
{
/* RA not active - checking if RRC is ready to initiate the RA procedure */
LOG_D
(
NR_MAC
,
"In %s: RA not active. Checking for data to transmit from upper layers...
\n
"
,
__FUNCTION__
);
const
uint8_t
lcid
=
UL_SCH_LCID_CCCH
;
const
uint8_t
sh_size
=
sizeof
(
NR_MAC_SUBHEADER_FIXED
);
const
uint8_t
TBS_max
=
8
+
sizeof
(
NR_MAC_SUBHEADER_SHORT
)
+
sizeof
(
NR_MAC_SUBHEADER_SHORT
);
// Note: unclear the reason behind the selection of such TBS_max
int8_t
size_sdu
=
0
;
uint8_t
mac_ce
[
16
]
=
{
0
};
uint8_t
*
pdu
=
get_softmodem_params
()
->
sa
?
mac
->
CCCH_pdu
.
payload
:
mac_ce
;
uint8_t
*
payload
=
pdu
;
LOG_D
(
NR_MAC
,
"RA not active. Checking for data to transmit from upper layers...
\n
"
);
// Concerning the C-RNTI MAC CE, it has to be included if the UL transmission (Msg3) is not being made for the CCCH logical channel.
// Therefore it has been assumed that this event only occurs only when RA is done and it is not SA mode.
if
(
get_softmodem_params
()
->
sa
)
{
int
TBS_max
=
848
;
//8 + sizeof(NR_MAC_SUBHEADER_SHORT) + sizeof(NR_MAC_SUBHEADER_SHORT);
payload
=
(
uint8_t
*
)
mac
->
CCCH_pdu
.
payload
;
mac_ce_len
=
0
;
num_sdus
=
1
;
post_padding
=
1
;
sdu_lcids
[
0
]
=
lcid
;
NR_MAC_SUBHEADER_FIXED
*
header
=
(
NR_MAC_SUBHEADER_FIXED
*
)
pdu
;
pdu
+=
sh_size
;
// initialisation by RRC
// initialisation by RRC
// TODO: To be removed after RA procedures fully implemented
if
(
get_softmodem_params
()
->
do_ra
)
{
nr_rrc_ue_generate_RRCSetupRequest
(
mod_id
,
gNB_id
);
size_sdu
=
(
uint16_t
)
nr_mac_rrc_data_req_ue
(
mod_id
,
CC_id
,
gNB_id
,
frame
,
CCCH
,
mac_sdus
);
// CCCH PDU
size_sdu
=
nr_mac_rrc_data_req_ue
(
mod_id
,
CC_id
,
gNB_id
,
frame
,
CCCH
,
pdu
);
LOG_D
(
NR_MAC
,
"In %s: [UE %d][%d.%d]: Requested RRCConnectionRequest, got %d bytes for LCID 0x%02x
\n
"
,
__FUNCTION__
,
mod_id
,
frame
,
nr_slot_tx
,
size_sdu
,
lcid
);
if
(
size_sdu
>
0
)
{
// UE Contention Resolution Identity
// Store the first 48 bits belonging to the uplink CCCH SDU within Msg3 to determine whether or not the
// Random Access Procedure has been successful after reception of Msg4
memcpy
(
ra
->
cont_res_id
,
pdu
,
sizeof
(
uint8_t
)
*
6
);
pdu
+=
size_sdu
;
ra
->
Msg3_size
=
size_sdu
+
sh_size
;
// Build header
header
->
R
=
0
;
header
->
LCID
=
lcid
;
}
else
{
pdu
-=
sh_size
;
sdu_lengths
[
0
]
=
size_sdu
;
LOG_D
(
NR_MAC
,
"[UE %d] Frame %d: Requested RRCConnectionRequest, got %d bytes
\n
"
,
mod_id
,
frame
,
size_sdu
);
}
else
{
// fill ulsch_buffer with random data
for
(
int
i
=
0
;
i
<
TBS_bytes
;
i
++
){
mac_sdus
[
i
]
=
(
unsigned
char
)
(
lrand48
()
&
0xff
);
}
//Sending SDUs with size 1
//Initialize elements of sdu_lcids and sdu_lengths
sdu_lcids
[
0
]
=
lcid
;
sdu_lengths
[
0
]
=
TBS_bytes
-
3
-
post_padding
-
mac_ce_len
;
header_length_total
+=
2
+
(
sdu_lengths
[
0
]
>=
128
);
size_sdu
+=
sdu_lengths
[
0
];
}
}
else
{
size_sdu
=
nr_write_ce_ulsch_pdu
(
pdu
,
mac
);
pdu
+=
size_sdu
;
ra
->
Msg3_size
=
size_sdu
;
if
(
size_sdu
>
0
)
{
}
// UE Contention Resolution Identity
// Store the first 48 bits belonging to the uplink CCCH SDU within Msg3 to determine whether or not the
// Random Access Procedure has been successful after reception of Msg4
memcpy
(
ra
->
cont_res_id
,
mac_sdus
,
sizeof
(
uint8_t
)
*
6
);
if
(
size_sdu
>
0
&&
ra
->
generate_nr_prach
==
GENERATE_PREAMBLE
)
{
LOG_D
(
NR_MAC
,
"[UE %d][%d.%d]: starting initialisation Random Access Procedure...
\n
"
,
mod_id
,
frame
,
nr_slot_tx
);
LOG_D
(
NR_MAC
,
"In %s: [UE %d][%d.%d]: starting initialisation Random Access Procedure...
\n
"
,
__FUNCTION__
,
mod_id
,
frame
,
nr_slot_tx
);
AssertFatal
(
TBS_max
>
ra
->
Msg3_size
,
"In %s: allocated resources are not enough for Msg3!
\n
"
,
__FUNCTION__
);
ra
->
Msg3_size
=
size_sdu
+
sizeof
(
NR_MAC_SUBHEADER_SHORT
)
+
sizeof
(
NR_MAC_SUBHEADER_SHORT
);
// Init RA procedure
init_RA
(
mod_id
,
prach_resources
,
setup
,
rach_ConfigGeneric
,
rach_ConfigDedicated
);
// prach_resources->Msg3 = payload;
nr_get_RA_window
(
mac
);
// Fill in preamble and PRACH resources
nr_get_prach_resources
(
mod_id
,
CC_id
,
gNB_id
,
prach_resources
,
prach_pdu
,
rach_ConfigDedicated
);
// Padding: fill remainder with 0
if
(
TBS_max
-
ra
->
Msg3_size
>
0
)
{
LOG_D
(
NR_MAC
,
"In %s: remaining %d bytes, filling with padding
\n
"
,
__FUNCTION__
,
TBS_max
-
ra
->
Msg3_size
);
((
NR_MAC_SUBHEADER_FIXED
*
)
pdu
)
->
R
=
0
;
((
NR_MAC_SUBHEADER_FIXED
*
)
pdu
)
->
LCID
=
UL_SCH_LCID_PADDING
;
pdu
+=
sizeof
(
NR_MAC_SUBHEADER_FIXED
);
for
(
int
j
=
0
;
j
<
TBS_max
-
ra
->
Msg3_size
-
sizeof
(
NR_MAC_SUBHEADER_FIXED
);
j
++
)
{
pdu
[
j
]
=
0
;
}
// Fill in preamble and PRACH resources
if
(
ra
->
generate_nr_prach
==
GENERATE_PREAMBLE
)
{
nr_get_prach_resources
(
mod_id
,
CC_id
,
gNB_id
,
prach_resources
,
prach_pdu
,
rach_ConfigDedicated
);
}
//
Dumping ULSCH payload
LOG_D
(
NR_MAC
,
"In %s: dumping UL Msg3 MAC PDU with length %d:
\n
"
,
__FUNCTION__
,
TBS_max
);
for
(
int
k
=
0
;
k
<
TBS_max
;
k
++
)
{
LOG_D
(
NR_MAC
,
"(%i): %i
\n
"
,
k
,
payload
[
k
])
;
//
Padding: fill remainder with 0
if
(
post_padding
>
0
){
for
(
int
j
=
0
;
j
<
(
TBS_max
-
offset
);
j
++
)
payload
[
offset
+
j
]
=
0
;
}
// Msg3 was initialized with TBS_max bytes because the RA_Msg3_size will only be known after
// receiving Msg2 (which contains the Msg3 resource reserve).
// Msg3 will be transmitted with RA_Msg3_size bytes, removing unnecessary 0s.
mac
->
ulsch_pdu
.
Pdu_size
=
TBS_max
;
memcpy
(
mac
->
ulsch_pdu
.
payload
,
payload
,
TBS_max
);
}
else
{
return
0
;
}
}
else
if
(
ra
->
RA_window_cnt
!=
-
1
)
{
// RACH is active
...
...
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