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
spbro
OpenXG-RAN
Commits
6108e5b8
Commit
6108e5b8
authored
Mar 15, 2024
by
Robert Schmidt
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/NR_UE_RRC_Reestablishment' into integration_2024_w11
parents
707c707c
c9cf72b3
Changes
27
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
526 additions
and
259 deletions
+526
-259
common/utils/nr/nr_common.c
common/utils/nr/nr_common.c
+109
-0
common/utils/nr/nr_common.h
common/utils/nr/nr_common.h
+2
-1
nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h
nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h
+1
-0
openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
+1
-9
openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c
openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c
+1
-10
openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
+0
-1
openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
+9
-1
openair1/SIMULATION/NR_PHY/nr_dummy_functions.c
openair1/SIMULATION/NR_PHY/nr_dummy_functions.c
+3
-1
openair1/SIMULATION/NR_PHY/pbchsim.c
openair1/SIMULATION/NR_PHY/pbchsim.c
+1
-9
openair2/COMMON/mac_messages_types.h
openair2/COMMON/mac_messages_types.h
+4
-1
openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c
openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c
+0
-112
openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h
openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h
+0
-4
openair2/LAYER2/NR_MAC_UE/config_ue.c
openair2/LAYER2/NR_MAC_UE/config_ue.c
+32
-13
openair2/LAYER2/NR_MAC_UE/mac_proto.h
openair2/LAYER2/NR_MAC_UE/mac_proto.h
+5
-1
openair2/LAYER2/NR_MAC_UE/main_ue_nr.c
openair2/LAYER2/NR_MAC_UE/main_ue_nr.c
+81
-47
openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
+3
-3
openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
+3
-3
openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c
openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c
+34
-4
openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h
openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h
+1
-0
openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c
openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c
+4
-1
openair2/RRC/NR/MESSAGES/asn1_msg.c
openair2/RRC/NR/MESSAGES/asn1_msg.c
+8
-5
openair2/RRC/NR/MESSAGES/asn1_msg.h
openair2/RRC/NR/MESSAGES/asn1_msg.h
+4
-1
openair2/RRC/NR_UE/L2_interface_ue.c
openair2/RRC/NR_UE/L2_interface_ue.c
+6
-1
openair2/RRC/NR_UE/rrc_UE.c
openair2/RRC/NR_UE/rrc_UE.c
+195
-26
openair2/RRC/NR_UE/rrc_defs.h
openair2/RRC/NR_UE/rrc_defs.h
+5
-2
openair2/RRC/NR_UE/rrc_proto.h
openair2/RRC/NR_UE/rrc_proto.h
+4
-1
openair2/RRC/NR_UE/rrc_timers_and_constants.c
openair2/RRC/NR_UE/rrc_timers_and_constants.c
+10
-2
No files found.
common/utils/nr/nr_common.c
View file @
6108e5b8
...
...
@@ -376,6 +376,115 @@ int get_nb_periods_per_frame(uint8_t tdd_period)
return
nb_periods_per_frame
;
}
void
get_delta_arfcn
(
int
i
,
uint32_t
nrarfcn
,
uint64_t
N_OFFs
)
{
uint32_t
delta_arfcn
=
nrarfcn
-
N_OFFs
;
if
(
delta_arfcn
%
(
nr_bandtable
[
i
].
step_size
)
!=
0
)
LOG_E
(
NR_MAC
,
"nrarfcn %u is not on the channel raster for step size %lu
\n
"
,
nrarfcn
,
nr_bandtable
[
i
].
step_size
);
}
uint32_t
to_nrarfcn
(
int
nr_bandP
,
uint64_t
dl_CarrierFreq
,
uint8_t
scs_index
,
uint32_t
bw
)
{
uint64_t
dl_CarrierFreq_by_1k
=
dl_CarrierFreq
/
1000
;
int
bw_kHz
=
bw
/
1000
;
uint32_t
nrarfcn
;
int
i
=
get_nr_table_idx
(
nr_bandP
,
scs_index
);
LOG_I
(
NR_MAC
,
"Searching for nr band %d DL Carrier frequency %llu bw %u
\n
"
,
nr_bandP
,
(
long
long
unsigned
int
)
dl_CarrierFreq
,
bw
);
AssertFatal
(
dl_CarrierFreq_by_1k
>=
nr_bandtable
[
i
].
dl_min
,
"Band %d, bw %u : DL carrier frequency %llu kHz < %llu
\n
"
,
nr_bandP
,
bw
,
(
long
long
unsigned
int
)
dl_CarrierFreq_by_1k
,
(
long
long
unsigned
int
)
nr_bandtable
[
i
].
dl_min
);
AssertFatal
(
dl_CarrierFreq_by_1k
<=
(
nr_bandtable
[
i
].
dl_max
-
bw_kHz
/
2
),
"Band %d, dl_CarrierFreq %llu bw %u: DL carrier frequency %llu kHz > %llu
\n
"
,
nr_bandP
,
(
long
long
unsigned
int
)
dl_CarrierFreq
,
bw
,
(
long
long
unsigned
int
)
dl_CarrierFreq_by_1k
,
(
long
long
unsigned
int
)(
nr_bandtable
[
i
].
dl_max
-
bw_kHz
/
2
));
int
deltaFglobal
=
60
;
uint32_t
N_REF_Offs
=
2016667
;
uint64_t
F_REF_Offs_khz
=
24250080
;
if
(
dl_CarrierFreq
<
24.25e9
)
{
deltaFglobal
=
15
;
N_REF_Offs
=
600000
;
F_REF_Offs_khz
=
3000000
;
}
if
(
dl_CarrierFreq
<
3e9
)
{
deltaFglobal
=
5
;
N_REF_Offs
=
0
;
F_REF_Offs_khz
=
0
;
}
// This is equation before Table 5.4.2.1-1 in 38101-1-f30
// F_REF=F_REF_Offs + deltaF_Global(N_REF-NREF_REF_Offs)
nrarfcn
=
(((
dl_CarrierFreq_by_1k
-
F_REF_Offs_khz
)
/
deltaFglobal
)
+
N_REF_Offs
);
//get_delta_arfcn(i, nrarfcn, nr_bandtable[i].N_OFFs_DL);
return
nrarfcn
;
}
// This function computes the RF reference frequency from the NR-ARFCN according to 5.4.2.1 of 3GPP TS 38.104
// this function applies to both DL and UL
uint64_t
from_nrarfcn
(
int
nr_bandP
,
uint8_t
scs_index
,
uint32_t
nrarfcn
)
{
int
deltaFglobal
=
5
;
uint32_t
N_REF_Offs
=
0
;
uint64_t
F_REF_Offs_khz
=
0
;
uint64_t
N_OFFs
,
frequency
,
freq_min
;
int
i
=
get_nr_table_idx
(
nr_bandP
,
scs_index
);
if
(
nrarfcn
>
599999
&&
nrarfcn
<
2016667
)
{
deltaFglobal
=
15
;
N_REF_Offs
=
600000
;
F_REF_Offs_khz
=
3000000
;
}
if
(
nrarfcn
>
2016666
&&
nrarfcn
<
3279166
)
{
deltaFglobal
=
60
;
N_REF_Offs
=
2016667
;
F_REF_Offs_khz
=
24250080
;
}
int32_t
delta_duplex
=
get_delta_duplex
(
nr_bandP
,
scs_index
);
if
(
delta_duplex
<=
0
){
// DL band >= UL band
if
(
nrarfcn
>=
nr_bandtable
[
i
].
N_OFFs_DL
){
// is TDD of FDD DL
N_OFFs
=
nr_bandtable
[
i
].
N_OFFs_DL
;
freq_min
=
nr_bandtable
[
i
].
dl_min
;
}
else
{
// is FDD UL
N_OFFs
=
nr_bandtable
[
i
].
N_OFFs_DL
+
delta_duplex
/
deltaFglobal
;
freq_min
=
nr_bandtable
[
i
].
ul_min
;
}
}
else
{
// UL band > DL band
if
(
nrarfcn
>=
nr_bandtable
[
i
].
N_OFFs_DL
+
delta_duplex
/
deltaFglobal
){
// is FDD UL
N_OFFs
=
nr_bandtable
[
i
].
N_OFFs_DL
+
delta_duplex
/
deltaFglobal
;
freq_min
=
nr_bandtable
[
i
].
ul_min
;
}
else
{
// is FDD DL
N_OFFs
=
nr_bandtable
[
i
].
N_OFFs_DL
;
freq_min
=
nr_bandtable
[
i
].
dl_min
;
}
}
LOG_D
(
NR_MAC
,
"Frequency from NR-ARFCN for N_OFFs %lu, duplex spacing %d KHz, deltaFglobal %d KHz
\n
"
,
N_OFFs
,
delta_duplex
,
deltaFglobal
);
AssertFatal
(
nrarfcn
>=
N_OFFs
,
"nrarfcn %u < N_OFFs[%d] %llu
\n
"
,
nrarfcn
,
nr_bandtable
[
i
].
band
,
(
long
long
unsigned
int
)
N_OFFs
);
get_delta_arfcn
(
i
,
nrarfcn
,
N_OFFs
);
frequency
=
1000
*
(
F_REF_Offs_khz
+
(
nrarfcn
-
N_REF_Offs
)
*
deltaFglobal
);
LOG_D
(
NR_MAC
,
"Computing frequency (nrarfcn %llu => %llu KHz (freq_min %llu KHz, NR band %d N_OFFs %llu))
\n
"
,
(
unsigned
long
long
)
nrarfcn
,
(
unsigned
long
long
)
frequency
/
1000
,
(
unsigned
long
long
)
freq_min
,
nr_bandP
,
(
unsigned
long
long
)
N_OFFs
);
return
frequency
;
}
int
get_first_ul_slot
(
int
nrofDownlinkSlots
,
int
nrofDownlinkSymbols
,
int
nrofUplinkSymbols
)
{
...
...
common/utils/nr/nr_common.h
View file @
6108e5b8
...
...
@@ -168,7 +168,8 @@ static inline int get_num_dmrs(uint16_t dmrs_mask ) {
}
uint64_t
reverse_bits
(
uint64_t
in
,
int
n_bits
);
uint64_t
from_nrarfcn
(
int
nr_bandP
,
uint8_t
scs_index
,
uint32_t
dl_nrarfcn
);
uint32_t
to_nrarfcn
(
int
nr_bandP
,
uint64_t
dl_CarrierFreq
,
uint8_t
scs_index
,
uint32_t
bw
);
int
get_first_ul_slot
(
int
nrofDownlinkSlots
,
int
nrofDownlinkSymbols
,
int
nrofUplinkSymbols
);
int
cce_to_reg_interleaving
(
const
int
R
,
int
k
,
int
n_shift
,
const
int
C
,
int
L
,
const
int
N_regs
);
int
get_SLIV
(
uint8_t
S
,
uint8_t
L
);
...
...
nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h
View file @
6108e5b8
...
...
@@ -132,6 +132,7 @@ typedef struct {
uint16_t
cell_id
;
uint16_t
ssb_start_subcarrier
;
short
rsrp_dBm
;
long
arfcn
;
rlm_t
radiolink_monitoring
;
// -1 no monitoring, 0 out_of_sync, 1 in_sync
}
fapi_nr_ssb_pdu_t
;
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
View file @
6108e5b8
...
...
@@ -153,15 +153,7 @@ int nr_pbch_detection(const UE_nr_rxtx_proc_t *proc,
stop_meas
(
&
ue
->
dlsch_channel_estimation_stats
);
fapiPbch_t
result
=
{
0
};
ret
=
nr_rx_pbch
(
ue
,
proc
,
estimateSz
,
dl_ch_estimates
,
frame_parms
,
temp_ptr
->
i_ssb
,
SISO
,
&
result
,
rxdataF
);
ret
=
nr_rx_pbch
(
ue
,
proc
,
estimateSz
,
dl_ch_estimates
,
frame_parms
,
temp_ptr
->
i_ssb
,
&
result
,
rxdataF
);
if
(
DUMP_PBCH_CH_ESTIMATES
&&
(
ret
==
0
))
{
write_output
(
"pbch_ch_estimates.m"
,
"pbch_ch_estimates"
,
dl_ch_estimates
,
frame_parms
->
nb_antennas_rx
*
estimateSz
,
1
,
1
);
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c
View file @
6108e5b8
...
...
@@ -361,7 +361,6 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue,
struct
complex16
dl_ch_estimates
[][
estimateSz
],
NR_DL_FRAME_PARMS
*
frame_parms
,
uint8_t
i_ssb
,
MIMO_mode_t
mimo_mode
,
fapiPbch_t
*
result
,
c16_t
rxdataF
[][
ue
->
frame_parms
.
samples_per_slot_wCP
])
{
...
...
@@ -414,7 +413,7 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue,
symbol_offset
,
frame_parms
);
#ifdef DEBUG_PBCH
LOG_I
(
PHY
,
"[PHY] PBCH Symbol %d ofdm size %d
\n
"
,
symbol
,
frame_parms
->
ofdm_symbol_size
);
LOG_I
(
PHY
,
"[PHY] PBCH Symbol %d ofdm size %d
\n
"
,
symbol
,
frame_parms
->
ofdm_symbol_size
);
LOG_I
(
PHY
,
"[PHY] PBCH starting channel_level
\n
"
);
#endif
...
...
@@ -441,14 +440,6 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue,
rxdataF_comp,
symbol);*/
/*
if (mimo_mode == ALAMOUTI) {
nr_pbch_alamouti(frame_parms,rxdataF_comp,symbol);
} else if (mimo_mode != SISO) {
LOG_I(PHY,"[PBCH][RX] Unsupported MIMO mode\n");
return(-1);
}
*/
int
nb
=
symbol
==
2
?
144
:
360
;
nr_pbch_quantize
(
pbch_e_rx
+
pbch_e_rx_idx
,
(
short
*
)
rxdataF_comp
[
0
],
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
View file @
6108e5b8
...
...
@@ -294,7 +294,6 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue,
struct
complex16
dl_ch_estimates
[][
estimateSz
],
NR_DL_FRAME_PARMS
*
frame_parms
,
uint8_t
i_ssb
,
MIMO_mode_t
mimo_mode
,
fapiPbch_t
*
result
,
c16_t
rxdataF
[][
ue
->
frame_parms
.
samples_per_slot_wCP
]);
...
...
openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
View file @
6108e5b8
...
...
@@ -109,6 +109,14 @@ void nr_fill_dl_indication(nr_downlink_indication_t *dl_ind,
}
}
static
uint32_t
get_ssb_arfcn
(
NR_DL_FRAME_PARMS
*
frame_parms
)
{
uint32_t
band_size_hz
=
frame_parms
->
N_RB_DL
*
12
*
frame_parms
->
subcarrier_spacing
;
int
ssb_center_sc
=
frame_parms
->
ssb_start_subcarrier
+
120
;
// ssb is 20 PRBs -> 240 sub-carriers
uint64_t
ssb_freq
=
frame_parms
->
dl_CarrierFreq
-
(
band_size_hz
/
2
)
+
frame_parms
->
subcarrier_spacing
*
ssb_center_sc
;
return
to_nrarfcn
(
frame_parms
->
nr_band
,
ssb_freq
,
frame_parms
->
numerology_index
,
band_size_hz
);
}
void
nr_fill_rx_indication
(
fapi_nr_rx_indication_t
*
rx_ind
,
uint8_t
pdu_type
,
PHY_VARS_NR_UE
*
ue
,
...
...
@@ -168,6 +176,7 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
ssb_pdu
->
cell_id
=
frame_parms
->
Nid_cell
;
ssb_pdu
->
ssb_start_subcarrier
=
frame_parms
->
ssb_start_subcarrier
;
ssb_pdu
->
rsrp_dBm
=
ue
->
measurements
.
ssb_rsrp_dBm
[
frame_parms
->
ssb_index
];
ssb_pdu
->
arfcn
=
get_ssb_arfcn
(
frame_parms
);
ssb_pdu
->
radiolink_monitoring
=
RLM_in_sync
;
// TODO to be removed from here
ssb_pdu
->
decoded_pdu
=
true
;
}
...
...
@@ -384,7 +393,6 @@ static int nr_ue_pbch_procedures(PHY_VARS_NR_UE *ue,
dl_ch_estimates
,
&
ue
->
frame_parms
,
(
ue
->
frame_parms
.
ssb_index
)
&
7
,
SISO
,
&
result
,
rxdataF
);
...
...
openair1/SIMULATION/NR_PHY/nr_dummy_functions.c
View file @
6108e5b8
...
...
@@ -32,7 +32,7 @@ void nr_mac_rrc_sync_ind(const module_id_t module_id,
const
frame_t
frame
,
const
bool
in_sync
)
{}
void
nr_mac_rrc_msg3_ind
(
const
module_id_t
mod_id
,
int
rnti
)
{}
void
nr_mac_rrc_msg3_ind
(
const
module_id_t
mod_id
,
int
rnti
,
int
gnb_id
)
{}
void
nr_mac_rrc_ra_ind
(
const
module_id_t
mod_id
,
int
frame
,
bool
success
)
{}
...
...
@@ -48,6 +48,8 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
const
frame_t
frame
,
const
int
slot
,
const
rnti_t
rnti
,
const
uint32_t
cellid
,
const
long
arfcn
,
const
channel_t
channel
,
const
uint8_t
*
pduP
,
const
sdu_size_t
pdu_len
)
{
return
0
;
}
...
...
openair1/SIMULATION/NR_PHY/pbchsim.c
View file @
6108e5b8
...
...
@@ -797,15 +797,7 @@ int main(int argc, char **argv)
}
fapiPbch_t
result
;
ret
=
nr_rx_pbch
(
UE
,
&
proc
,
estimateSz
,
dl_ch_estimates
,
frame_parms
,
ssb_index
%
8
,
SISO
,
&
result
,
rxdataF
);
ret
=
nr_rx_pbch
(
UE
,
&
proc
,
estimateSz
,
dl_ch_estimates
,
frame_parms
,
ssb_index
%
8
,
&
result
,
rxdataF
);
if
(
ret
==
0
)
{
//UE->rx_ind.rx_indication_body->mib_pdu.ssb_index; //not yet detected automatically
...
...
openair2/COMMON/mac_messages_types.h
View file @
6108e5b8
...
...
@@ -76,7 +76,8 @@ typedef struct NRRrcMacRaInd_s {
}
NRRrcMacRaInd
;
typedef
struct
NRRrcMacMsg3Ind_s
{
uint16_t
rnti
;
uint16_t
rnti
;
int
gnb_id
;
}
NRRrcMacMsg3Ind
;
typedef
struct
RrcMacInSyncInd_s
{
...
...
@@ -118,6 +119,8 @@ typedef struct NRRrcMacBcchDataInd_s {
bool
is_bch
;
uint8_t
rsrq
;
uint8_t
rsrp
;
uint32_t
phycellid
;
long
ssb_arfcn
;
}
NRRrcMacBcchDataInd
;
typedef
struct
NRRrcMacSBcchDataInd_s
{
...
...
openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c
View file @
6108e5b8
...
...
@@ -2248,118 +2248,6 @@ static const uint16_t table_7_3_1_1_2_32[3][15] = {
{
0
,
1
,
2
,
3
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
},
};
void
get_delta_arfcn
(
int
i
,
uint32_t
nrarfcn
,
uint64_t
N_OFFs
)
{
uint32_t
delta_arfcn
=
nrarfcn
-
N_OFFs
;
if
(
delta_arfcn
%
(
nr_bandtable
[
i
].
step_size
)
!=
0
)
LOG_E
(
NR_MAC
,
"nrarfcn %u is not on the channel raster for step size %lu
\n
"
,
nrarfcn
,
nr_bandtable
[
i
].
step_size
);
}
uint32_t
to_nrarfcn
(
int
nr_bandP
,
uint64_t
dl_CarrierFreq
,
uint8_t
scs_index
,
uint32_t
bw
)
{
uint64_t
dl_CarrierFreq_by_1k
=
dl_CarrierFreq
/
1000
;
int
bw_kHz
=
bw
/
1000
;
uint32_t
nrarfcn
;
int
i
=
get_nr_table_idx
(
nr_bandP
,
scs_index
);
LOG_I
(
NR_MAC
,
"Searching for nr band %d DL Carrier frequency %llu bw %u
\n
"
,
nr_bandP
,(
long
long
unsigned
int
)
dl_CarrierFreq
,
bw
);
AssertFatal
(
dl_CarrierFreq_by_1k
>=
nr_bandtable
[
i
].
dl_min
,
"Band %d, bw %u : DL carrier frequency %llu kHz < %llu
\n
"
,
nr_bandP
,
bw
,
(
long
long
unsigned
int
)
dl_CarrierFreq_by_1k
,
(
long
long
unsigned
int
)
nr_bandtable
[
i
].
dl_min
);
AssertFatal
(
dl_CarrierFreq_by_1k
<=
(
nr_bandtable
[
i
].
dl_max
-
bw_kHz
/
2
),
"Band %d, dl_CarrierFreq %llu bw %u: DL carrier frequency %llu kHz > %llu
\n
"
,
nr_bandP
,
(
long
long
unsigned
int
)
dl_CarrierFreq
,
bw
,
(
long
long
unsigned
int
)
dl_CarrierFreq_by_1k
,
(
long
long
unsigned
int
)(
nr_bandtable
[
i
].
dl_max
-
bw_kHz
/
2
));
int
deltaFglobal
=
60
;
uint32_t
N_REF_Offs
=
2016667
;
uint64_t
F_REF_Offs_khz
=
24250080
;
if
(
dl_CarrierFreq
<
24.25e9
)
{
deltaFglobal
=
15
;
N_REF_Offs
=
600000
;
F_REF_Offs_khz
=
3000000
;
}
if
(
dl_CarrierFreq
<
3e9
)
{
deltaFglobal
=
5
;
N_REF_Offs
=
0
;
F_REF_Offs_khz
=
0
;
}
// This is equation before Table 5.4.2.1-1 in 38101-1-f30
// F_REF=F_REF_Offs + deltaF_Global(N_REF-NREF_REF_Offs)
nrarfcn
=
(((
dl_CarrierFreq_by_1k
-
F_REF_Offs_khz
)
/
deltaFglobal
)
+
N_REF_Offs
);
//get_delta_arfcn(i, nrarfcn, nr_bandtable[i].N_OFFs_DL);
return
nrarfcn
;
}
// This function computes the RF reference frequency from the NR-ARFCN according to 5.4.2.1 of 3GPP TS 38.104
// this function applies to both DL and UL
uint64_t
from_nrarfcn
(
int
nr_bandP
,
uint8_t
scs_index
,
uint32_t
nrarfcn
)
{
int
deltaFglobal
=
5
;
uint32_t
N_REF_Offs
=
0
;
uint64_t
F_REF_Offs_khz
=
0
;
uint64_t
N_OFFs
,
frequency
,
freq_min
;
int
i
=
get_nr_table_idx
(
nr_bandP
,
scs_index
);
if
(
nrarfcn
>
599999
&&
nrarfcn
<
2016667
)
{
deltaFglobal
=
15
;
N_REF_Offs
=
600000
;
F_REF_Offs_khz
=
3000000
;
}
if
(
nrarfcn
>
2016666
&&
nrarfcn
<
3279166
)
{
deltaFglobal
=
60
;
N_REF_Offs
=
2016667
;
F_REF_Offs_khz
=
24250080
;
}
int32_t
delta_duplex
=
get_delta_duplex
(
nr_bandP
,
scs_index
);
if
(
delta_duplex
<=
0
){
// DL band >= UL band
if
(
nrarfcn
>=
nr_bandtable
[
i
].
N_OFFs_DL
){
// is TDD of FDD DL
N_OFFs
=
nr_bandtable
[
i
].
N_OFFs_DL
;
freq_min
=
nr_bandtable
[
i
].
dl_min
;
}
else
{
// is FDD UL
N_OFFs
=
nr_bandtable
[
i
].
N_OFFs_DL
+
delta_duplex
/
deltaFglobal
;
freq_min
=
nr_bandtable
[
i
].
ul_min
;
}
}
else
{
// UL band > DL band
if
(
nrarfcn
>=
nr_bandtable
[
i
].
N_OFFs_DL
+
delta_duplex
/
deltaFglobal
){
// is FDD UL
N_OFFs
=
nr_bandtable
[
i
].
N_OFFs_DL
+
delta_duplex
/
deltaFglobal
;
freq_min
=
nr_bandtable
[
i
].
ul_min
;
}
else
{
// is FDD DL
N_OFFs
=
nr_bandtable
[
i
].
N_OFFs_DL
;
freq_min
=
nr_bandtable
[
i
].
dl_min
;
}
}
LOG_D
(
NR_MAC
,
"Frequency from NR-ARFCN for N_OFFs %lu, duplex spacing %d KHz, deltaFglobal %d KHz
\n
"
,
N_OFFs
,
delta_duplex
,
deltaFglobal
);
AssertFatal
(
nrarfcn
>=
N_OFFs
,
"nrarfcn %u < N_OFFs[%d] %llu
\n
"
,
nrarfcn
,
nr_bandtable
[
i
].
band
,
(
long
long
unsigned
int
)
N_OFFs
);
get_delta_arfcn
(
i
,
nrarfcn
,
N_OFFs
);
frequency
=
1000
*
(
F_REF_Offs_khz
+
(
nrarfcn
-
N_REF_Offs
)
*
deltaFglobal
);
LOG_D
(
NR_MAC
,
"Computing frequency (nrarfcn %llu => %llu KHz (freq_min %llu KHz, NR band %d N_OFFs %llu))
\n
"
,
(
unsigned
long
long
)
nrarfcn
,
(
unsigned
long
long
)
frequency
/
1000
,
(
unsigned
long
long
)
freq_min
,
nr_bandP
,
(
unsigned
long
long
)
N_OFFs
);
return
frequency
;
}
void
nr_get_tbs_dl
(
nfapi_nr_dl_tti_pdsch_pdu
*
pdsch_pdu
,
int
x_overhead
,
uint8_t
numdmrscdmgroupnodata
,
...
...
openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h
View file @
6108e5b8
...
...
@@ -55,10 +55,6 @@ uint32_t get_Y(const NR_SearchSpace_t *ss, int slot, rnti_t rnti);
uint8_t
get_BG
(
uint32_t
A
,
uint16_t
R
);
uint64_t
from_nrarfcn
(
int
nr_bandP
,
uint8_t
scs_index
,
uint32_t
dl_nrarfcn
);
uint32_t
to_nrarfcn
(
int
nr_bandP
,
uint64_t
dl_CarrierFreq
,
uint8_t
scs_index
,
uint32_t
bw
);
int16_t
fill_dmrs_mask
(
const
NR_PDSCH_Config_t
*
pdsch_Config
,
int
dci_format
,
int
dmrs_TypeA_Position
,
...
...
openair2/LAYER2/NR_MAC_UE/config_ue.c
View file @
6108e5b8
...
...
@@ -1355,21 +1355,40 @@ static void configure_common_BWP_ul(NR_UE_MAC_INST_t *mac, int bwp_id, NR_BWP_Up
}
void
nr_rrc_mac_config_req_reset
(
module_id_t
module_id
,
NR_UE_MAC_reset_cause_t
reset_
cause
)
NR_UE_MAC_reset_cause_t
cause
)
{
NR_UE_MAC_INST_t
*
mac
=
get_mac_inst
(
module_id
);
reset_mac_inst
(
mac
);
reset_ra
(
&
mac
->
ra
);
release_mac_configuration
(
mac
);
nr_ue_init_mac
(
mac
);
// Sending to PHY a request to resync
// with no target cell ID
if
(
reset_cause
!=
DETACH
)
{
mac
->
synch_request
.
Mod_id
=
module_id
;
mac
->
synch_request
.
CC_id
=
0
;
mac
->
synch_request
.
synch_req
.
target_Nid_cell
=
-
1
;
mac
->
if_module
->
synch_request
(
&
mac
->
synch_request
);
switch
(
cause
)
{
case
GO_TO_IDLE
:
reset_ra
(
&
mac
->
ra
);
release_mac_configuration
(
mac
,
cause
);
nr_ue_init_mac
(
mac
);
nr_ue_mac_default_configs
(
mac
);
// new sync but no target cell id -> -1
nr_ue_send_synch_request
(
mac
,
module_id
,
0
,
-
1
);
break
;
case
DETACH
:
reset_ra
(
&
mac
->
ra
);
reset_mac_inst
(
mac
);
nr_ue_reset_sync_state
(
mac
);
release_mac_configuration
(
mac
,
cause
);
break
;
case
T300_EXPIRY
:
reset_mac_inst
(
mac
);
reset_ra
(
&
mac
->
ra
);
mac
->
state
=
UE_SYNC
;
// still in sync but need to restart RA
break
;
case
RE_ESTABLISHMENT
:
reset_mac_inst
(
mac
);
nr_ue_mac_default_configs
(
mac
);
nr_ue_reset_sync_state
(
mac
);
release_mac_configuration
(
mac
,
cause
);
// new sync with old cell ID (re-establishment on the same cell)
nr_ue_send_synch_request
(
mac
,
module_id
,
0
,
mac
->
physCellId
);
break
;
default:
AssertFatal
(
false
,
"Invalid MAC reset cause %d
\n
"
,
cause
);
}
}
...
...
openair2/LAYER2/NR_MAC_UE/mac_proto.h
View file @
6108e5b8
...
...
@@ -205,7 +205,8 @@ NR_UE_MAC_INST_t *get_mac_inst(module_id_t module_id);
void
reset_mac_inst
(
NR_UE_MAC_INST_t
*
nr_mac
);
void
reset_ra
(
RA_config_t
*
ra
);
void
release_mac_configuration
(
NR_UE_MAC_INST_t
*
mac
);
void
release_mac_configuration
(
NR_UE_MAC_INST_t
*
mac
,
NR_UE_MAC_reset_cause_t
cause
);
/**\brief called at each slot, slot length based on numerology. now use u=0, scs=15kHz, slot=1ms
performs BSR/SR/PHR procedures, random access procedure handler and DLSCH/ULSCH procedures.
...
...
@@ -450,6 +451,9 @@ void nr_get_prach_resources(NR_UE_MAC_INST_t *mac,
void
prepare_msg4_feedback
(
NR_UE_MAC_INST_t
*
mac
,
int
pid
,
int
ack_nack
);
void
configure_initial_pucch
(
PUCCH_sched_t
*
pucch
,
int
res_ind
);
void
nr_ue_reset_sync_state
(
NR_UE_MAC_INST_t
*
mac
);
void
nr_ue_send_synch_request
(
NR_UE_MAC_INST_t
*
mac
,
module_id_t
module_id
,
int
cc_id
,
int
cell_id
);
void
init_RA
(
NR_UE_MAC_INST_t
*
mac
,
NR_PRACH_RESOURCES_t
*
prach_resources
,
NR_RACH_ConfigCommon_t
*
nr_rach_ConfigCommon
,
...
...
openair2/LAYER2/NR_MAC_UE/main_ue_nr.c
View file @
6108e5b8
...
...
@@ -56,12 +56,11 @@ void send_srb0_rrc(int ue_id, const uint8_t *sdu, sdu_size_t sdu_len, void *data
void
nr_ue_init_mac
(
NR_UE_MAC_INST_t
*
mac
)
{
LOG_I
(
NR_MAC
,
"[UE%d] Initializing MAC
\n
"
,
mac
->
ue_id
);
mac
->
first_sync_frame
=
-
1
;
nr_ue_reset_sync_state
(
mac
)
;
mac
->
get_sib1
=
false
;
mac
->
get_otherSI
=
false
;
mac
->
phy_config_request_sent
=
false
;
memset
(
&
mac
->
phy_config
,
0
,
sizeof
(
mac
->
phy_config
));
mac
->
state
=
UE_NOT_SYNC
;
mac
->
si_window_start
=
-
1
;
mac
->
servCellIndex
=
0
;
mac
->
harq_ACK_SpatialBundlingPUCCH
=
false
;
...
...
@@ -69,6 +68,9 @@ void nr_ue_init_mac(NR_UE_MAC_INST_t *mac)
mac
->
uecap_maxMIMO_PDSCH_layers
=
0
;
mac
->
uecap_maxMIMO_PUSCH_layers_cb
=
0
;
mac
->
uecap_maxMIMO_PUSCH_layers_nocb
=
0
;
mac
->
p_Max
=
INT_MIN
;
mac
->
p_Max_alt
=
INT_MIN
;
reset_mac_inst
(
mac
);
memset
(
&
mac
->
ssb_measurements
,
0
,
sizeof
(
mac
->
ssb_measurements
));
memset
(
&
mac
->
ul_time_alignment
,
0
,
sizeof
(
mac
->
ul_time_alignment
));
...
...
@@ -76,35 +78,32 @@ void nr_ue_init_mac(NR_UE_MAC_INST_t *mac)
memset
(
&
mac
->
ssb_list
[
i
],
0
,
sizeof
(
mac
->
ssb_list
[
i
]));
memset
(
&
mac
->
prach_assoc_pattern
[
i
],
0
,
sizeof
(
mac
->
prach_assoc_pattern
[
i
]));
}
for
(
int
k
=
0
;
k
<
NR_MAX_HARQ_PROCESSES
;
k
++
)
{
mac
->
ul_harq_info
[
k
].
last_ndi
=
-
1
;
// initialize to invalid value
mac
->
dl_harq_info
[
k
].
last_ndi
=
-
1
;
// initialize to invalid value
}
}
void
nr_ue_mac_default_configs
(
NR_UE_MAC_INST_t
*
mac
)
{
// default values as defined in 38.331 sec 9.2.2
mac
->
scheduling_info
.
retxBSR_Timer
=
NR_BSR_Config__retxBSR_Timer_sf10240
;
mac
->
scheduling_info
.
periodicBSR_Timer
=
NR_BSR_Config__periodicBSR_Timer_infinity
;
mac
->
scheduling_info
.
SR_COUNTER
=
0
;
mac
->
scheduling_info
.
SR_pending
=
0
;
mac
->
scheduling_info
.
sr_ProhibitTimer
=
0
;
mac
->
scheduling_info
.
sr_ProhibitTimer_Running
=
0
;
mac
->
scheduling_info
.
sr_id
=
-
1
;
// invalid init value
// set init value 0xFFFF, make sure periodic timer and retx time counters are NOT active, after bsr transmission set the value
// configured by the NW.
mac
->
scheduling_info
.
periodicBSR_SF
=
NR_MAC_UE_BSR_TIMER_NOT_RUNNING
;
mac
->
scheduling_info
.
retxBSR_SF
=
NR_MAC_UE_BSR_TIMER_NOT_RUNNING
;
mac
->
BSR_reporting_active
=
NR_BSR_TRIGGER_NONE
;
mac
->
scheduling_info
.
retxBSR_Timer
=
NR_BSR_Config__retxBSR_Timer_sf80
;
mac
->
scheduling_info
.
periodicBSR_Timer
=
NR_BSR_Config__periodicBSR_Timer_sf10
;
mac
->
scheduling_info
.
periodicPHR_Timer
=
NR_PHR_Config__phr_PeriodicTimer_sf10
;
mac
->
scheduling_info
.
prohibitPHR_Timer
=
NR_PHR_Config__phr_ProhibitTimer_sf10
;
}
for
(
int
i
=
0
;
i
<
NR_MAX_NUM_LCID
;
i
++
)
{
LOG_D
(
NR_MAC
,
"Applying default logical channel config for LCGID %d
\n
"
,
i
);
mac
->
scheduling_info
.
lc_sched_info
[
i
].
LCID_buffer_with_data
=
false
;
mac
->
scheduling_info
.
lc_sched_info
[
i
].
LCID_buffer_remain
=
0
;
mac
->
scheduling_info
.
lc_sched_info
[
i
].
Bj
=
0
;
}
void
nr_ue_send_synch_request
(
NR_UE_MAC_INST_t
*
mac
,
module_id_t
module_id
,
int
cc_id
,
int
cell_id
)
{
// Sending to PHY a request to resync
mac
->
synch_request
.
Mod_id
=
module_id
;
mac
->
synch_request
.
CC_id
=
cc_id
;
mac
->
synch_request
.
synch_req
.
target_Nid_cell
=
cell_id
;
mac
->
if_module
->
synch_request
(
&
mac
->
synch_request
);
}
void
nr_ue_reset_sync_state
(
NR_UE_MAC_INST_t
*
mac
)
{
// reset synchornization status
mac
->
first_sync_frame
=
-
1
;
mac
->
state
=
UE_NOT_SYNC
;
mac
->
ra
.
ra_state
=
RA_UE_IDLE
;
}
NR_UE_MAC_INST_t
*
nr_l2_init_ue
(
int
nb_inst
)
...
...
@@ -144,14 +143,16 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac)
{
// MAC reset according to 38.321 Section 5.12
nr_ue_mac_default_configs
(
nr_mac
);
// initialize Bj for each logical channel to zero
for
(
int
i
=
0
;
i
<
NR_MAX_NUM_LCID
;
i
++
)
// TODO reset also other status variables of LC, is this ok?
for
(
int
i
=
0
;
i
<
NR_MAX_NUM_LCID
;
i
++
)
{
nr_mac
->
scheduling_info
.
lc_sched_info
[
i
].
Bj
=
0
;
nr_mac
->
scheduling_info
.
lc_sched_info
[
i
].
LCID_buffer_with_data
=
false
;
nr_mac
->
scheduling_info
.
lc_sched_info
[
i
].
LCID_buffer_remain
=
0
;
}
// stop all running timers
// TODO
//
TODO
stop all running timers
nr_timer_stop
(
&
nr_mac
->
ra
.
contention_resolution_timer
);
// consider all timeAlignmentTimers as expired and perform the corresponding actions in clause 5.2
// TODO
...
...
@@ -171,10 +172,16 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac)
free_and_zero
(
nr_mac
->
ra
.
Msg3_buffer
);
// cancel any triggered Scheduling Request procedure
// Done in default config
nr_mac
->
scheduling_info
.
SR_COUNTER
=
0
;
nr_mac
->
scheduling_info
.
SR_pending
=
0
;
nr_mac
->
scheduling_info
.
sr_ProhibitTimer
=
0
;
nr_mac
->
scheduling_info
.
sr_ProhibitTimer_Running
=
0
;
nr_mac
->
scheduling_info
.
sr_id
=
-
1
;
// invalid init value
// cancel any triggered Buffer Status Reporting procedure
// Done in default config
nr_mac
->
scheduling_info
.
periodicBSR_SF
=
NR_MAC_UE_BSR_TIMER_NOT_RUNNING
;
nr_mac
->
scheduling_info
.
retxBSR_SF
=
NR_MAC_UE_BSR_TIMER_NOT_RUNNING
;
nr_mac
->
BSR_reporting_active
=
NR_BSR_TRIGGER_NONE
;
// cancel any triggered Power Headroom Reporting procedure
// TODO PHR not implemented yet
...
...
@@ -194,12 +201,24 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac)
// TODO beam failure procedure not implemented
}
void
release_mac_configuration
(
NR_UE_MAC_INST_t
*
mac
)
void
release_mac_configuration
(
NR_UE_MAC_INST_t
*
mac
,
NR_UE_MAC_reset_cause_t
cause
)
{
asn1cFreeStruc
(
asn_DEF_NR_MIB
,
mac
->
mib
);
asn1cFreeStruc
(
asn_DEF_NR_SI_SchedulingInfo
,
mac
->
si_SchedulingInfo
);
asn1cFreeStruc
(
asn_DEF_NR_TDD_UL_DL_ConfigCommon
,
mac
->
tdd_UL_DL_ConfigurationCommon
);
NR_UE_ServingCell_Info_t
*
sc
=
&
mac
->
sc_info
;
// if cause is Re-establishment, release spCellConfig only
if
(
cause
==
GO_TO_IDLE
)
{
asn1cFreeStruc
(
asn_DEF_NR_MIB
,
mac
->
mib
);
asn1cFreeStruc
(
asn_DEF_NR_SearchSpace
,
mac
->
search_space_zero
);
asn1cFreeStruc
(
asn_DEF_NR_ControlResourceSet
,
mac
->
coreset0
);
asn1cFreeStruc
(
asn_DEF_NR_SI_SchedulingInfo
,
mac
->
si_SchedulingInfo
);
asn1cFreeStruc
(
asn_DEF_NR_TDD_UL_DL_ConfigCommon
,
mac
->
tdd_UL_DL_ConfigurationCommon
);
for
(
int
i
=
0
;
i
<
mac
->
lc_ordered_list
.
count
;
i
++
)
{
nr_lcordered_info_t
*
lc_info
=
mac
->
lc_ordered_list
.
array
[
i
];
asn_sequence_del
(
&
mac
->
lc_ordered_list
,
i
,
0
);
free
(
lc_info
);
}
}
asn1cFreeStruc
(
asn_DEF_NR_CrossCarrierSchedulingConfig
,
sc
->
crossCarrierSchedulingConfig
);
asn1cFreeStruc
(
asn_DEF_NR_SRS_CarrierSwitching
,
sc
->
carrierSwitching
);
asn1cFreeStruc
(
asn_DEF_NR_UplinkConfig
,
sc
->
supplementaryUplink
);
...
...
@@ -218,20 +237,35 @@ void release_mac_configuration(NR_UE_MAC_INST_t *mac)
mac
->
current_DL_BWP
=
NULL
;
mac
->
current_UL_BWP
=
NULL
;
for
(
int
i
=
0
;
i
<
mac
->
dl_BWPs
.
count
;
i
++
)
// in case of re-establishment we don't need to release initial BWP config common
int
first_bwp_rel
=
0
;
// first BWP to release
if
(
cause
==
RE_ESTABLISHMENT
)
{
first_bwp_rel
=
1
;
// release dedicated BWP0 config
NR_UE_DL_BWP_t
*
bwp
=
mac
->
dl_BWPs
.
array
[
0
];
NR_BWP_PDCCH_t
*
pdcch
=
&
mac
->
config_BWP_PDCCH
[
0
];
for
(
int
i
=
0
;
pdcch
->
list_Coreset
.
count
;
i
++
)
asn_sequence_del
(
&
pdcch
->
list_Coreset
,
i
,
1
);
for
(
int
i
=
0
;
pdcch
->
list_SS
.
count
;
i
++
)
asn_sequence_del
(
&
pdcch
->
list_SS
,
i
,
1
);
asn1cFreeStruc
(
asn_DEF_NR_PDSCH_Config
,
bwp
->
pdsch_Config
);
NR_UE_UL_BWP_t
*
ubwp
=
mac
->
ul_BWPs
.
array
[
0
];
asn1cFreeStruc
(
asn_DEF_NR_PUCCH_Config
,
ubwp
->
pucch_Config
);
asn1cFreeStruc
(
asn_DEF_NR_SRS_Config
,
ubwp
->
srs_Config
);
asn1cFreeStruc
(
asn_DEF_NR_PUSCH_Config
,
ubwp
->
pusch_Config
);
mac
->
current_DL_BWP
=
bwp
;
mac
->
current_UL_BWP
=
ubwp
;
mac
->
sc_info
.
initial_dl_BWPSize
=
bwp
->
BWPSize
;
mac
->
sc_info
.
initial_dl_BWPStart
=
bwp
->
BWPStart
;
mac
->
sc_info
.
initial_ul_BWPSize
=
ubwp
->
BWPSize
;
mac
->
sc_info
.
initial_ul_BWPStart
=
ubwp
->
BWPStart
;
}
for
(
int
i
=
first_bwp_rel
;
i
<
mac
->
dl_BWPs
.
count
;
i
++
)
release_dl_BWP
(
mac
,
i
);
for
(
int
i
=
0
;
i
<
mac
->
ul_BWPs
.
count
;
i
++
)
for
(
int
i
=
first_bwp_rel
;
i
<
mac
->
ul_BWPs
.
count
;
i
++
)
release_ul_BWP
(
mac
,
i
);
asn1cFreeStruc
(
asn_DEF_NR_SearchSpace
,
mac
->
search_space_zero
);
asn1cFreeStruc
(
asn_DEF_NR_ControlResourceSet
,
mac
->
coreset0
);
for
(
int
i
=
0
;
i
<
mac
->
lc_ordered_list
.
count
;
i
++
)
{
nr_lcordered_info_t
*
lc_info
=
mac
->
lc_ordered_list
.
array
[
i
];
asn_sequence_del
(
&
mac
->
lc_ordered_list
,
i
,
0
);
free
(
lc_info
);
}
memset
(
&
mac
->
ssb_measurements
,
0
,
sizeof
(
mac
->
ssb_measurements
));
memset
(
&
mac
->
csirs_measurements
,
0
,
sizeof
(
mac
->
csirs_measurements
));
memset
(
&
mac
->
ul_time_alignment
,
0
,
sizeof
(
mac
->
ul_time_alignment
));
...
...
openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
View file @
6108e5b8
...
...
@@ -264,7 +264,7 @@ int8_t nr_ue_decode_BCCH_DL_SCH(NR_UE_MAC_INST_t *mac,
{
if
(
ack_nack
)
{
LOG_D
(
NR_MAC
,
"Decoding NR-BCCH-DL-SCH-Message (SIB1 or SI)
\n
"
);
nr_mac_rrc_data_ind_ue
(
mac
->
ue_id
,
cc_id
,
gNB_index
,
0
,
0
,
0
,
NR_BCCH_DL_SCH
,
(
uint8_t
*
)
pduP
,
pdu_len
);
nr_mac_rrc_data_ind_ue
(
mac
->
ue_id
,
cc_id
,
gNB_index
,
0
,
0
,
0
,
mac
->
physCellId
,
0
,
NR_BCCH_DL_SCH
,
(
uint8_t
*
)
pduP
,
pdu_len
);
mac
->
get_sib1
=
false
;
mac
->
get_otherSI
=
false
;
}
...
...
@@ -3774,7 +3774,7 @@ int nr_write_ce_ulsch_pdu(uint8_t *mac_ce,
// - optimize: mu_pusch, j and table_6_1_2_1_1_2_time_dom_res_alloc_A are already defined in nr_ue_procedures
static
void
nr_ue_process_rar
(
NR_UE_MAC_INST_t
*
mac
,
nr_downlink_indication_t
*
dl_info
,
int
pdu_id
)
{
frame_t
frame
=
dl_info
->
frame
;
frame_t
frame
=
dl_info
->
frame
;
int
slot
=
dl_info
->
slot
;
if
(
dl_info
->
rx_ind
->
rx_indication_body
[
pdu_id
].
pdsch_pdu
.
ack_nack
==
0
)
{
...
...
@@ -3976,7 +3976,7 @@ static void nr_ue_process_rar(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *d
if
(
!
ra
->
cfra
)
{
ra
->
t_crnti
=
rar
->
TCRNTI_2
+
(
rar
->
TCRNTI_1
<<
8
);
rnti
=
ra
->
t_crnti
;
nr_mac_rrc_msg3_ind
(
mac
->
ue_id
,
rnti
);
nr_mac_rrc_msg3_ind
(
mac
->
ue_id
,
rnti
,
dl_info
->
gNB_index
);
}
fapi_nr_ul_config_request_pdu_t
*
pdu
=
lockGet_ul_config
(
mac
,
frame_tx
,
slot_tx
,
FAPI_NR_UL_CONFIG_TYPE_PUSCH
);
if
(
!
pdu
)
...
...
openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
View file @
6108e5b8
...
...
@@ -553,6 +553,9 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
pusch_config_pdu
->
bwp_start
=
current_UL_BWP
->
BWPStart
;
pusch_config_pdu
->
bwp_size
=
current_UL_BWP
->
BWPSize
;
pusch_config_pdu
->
start_symbol_index
=
tda_info
->
startSymbolIndex
;
pusch_config_pdu
->
nr_of_symbols
=
tda_info
->
nrOfSymbols
;
/* Transform precoding */
pusch_config_pdu
->
transform_precoding
=
get_transformPrecoding
(
current_UL_BWP
,
dci_format
,
0
);
...
...
@@ -637,9 +640,6 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
return
-
1
;
}
pusch_config_pdu
->
start_symbol_index
=
tda_info
->
startSymbolIndex
;
pusch_config_pdu
->
nr_of_symbols
=
tda_info
->
nrOfSymbols
;
/* FREQ_HOPPING_FLAG */
if
((
pusch_Config
!=
NULL
)
&&
(
pusch_Config
->
frequencyHopping
!=
NULL
)
&&
(
pusch_Config
->
resourceAllocation
!=
NR_PUSCH_Config__resourceAllocation_resourceAllocationType0
)){
pusch_config_pdu
->
frequency_hopping
=
dci
->
frequency_hopping_flag
.
val
;
...
...
openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c
View file @
6108e5b8
...
...
@@ -83,6 +83,24 @@ static void release_rlc_entity_from_lcid(nr_rlc_ue_t *ue, logical_chan_id_t chan
}
}
logical_chan_id_t
nr_rlc_get_lcid_from_rb
(
int
ue_id
,
bool
is_srb
,
int
rb_id
)
{
nr_rlc_manager_lock
(
nr_rlc_ue_manager
);
nr_rlc_ue_t
*
ue
=
nr_rlc_manager_get_ue
(
nr_rlc_ue_manager
,
ue_id
);
for
(
logical_chan_id_t
id
=
1
;
id
<=
32
;
id
++
)
{
nr_rlc_rb_t
*
rb
=
&
ue
->
lcid2rb
[
id
-
1
];
if
(
is_srb
)
{
if
(
rb
->
type
==
NR_RLC_SRB
&&
rb
->
choice
.
srb_id
==
rb_id
)
return
id
;
}
else
{
if
(
rb
->
type
==
NR_RLC_DRB
&&
rb
->
choice
.
drb_id
==
rb_id
)
return
id
;
}
}
LOG_E
(
RLC
,
"Couldn't find LCID corresponding to %s %d
\n
"
,
is_srb
?
"SRB"
:
"DRB"
,
rb_id
);
return
0
;
}
static
nr_rlc_entity_t
*
get_rlc_entity_from_lcid
(
nr_rlc_ue_t
*
ue
,
logical_chan_id_t
channel_id
)
{
if
(
channel_id
==
0
)
...
...
@@ -120,7 +138,7 @@ void nr_rlc_release_entity(int rnti, logical_chan_id_t channel_id)
void
mac_rlc_data_ind
(
const
module_id_t
module_idP
,
const
rnti_t
rntiP
,
const
eNB_index_t
eNB_index
,
const
frame_t
rameP
,
const
frame_t
f
rameP
,
const
eNB_flag_t
enb_flagP
,
const
MBMS_flag_t
MBMS_flagP
,
const
logical_chan_id_t
channel_idP
,
...
...
@@ -631,9 +649,10 @@ void nr_rlc_reestablish_entity(int rnti, int lc_id)
nr_rlc_manager_lock
(
nr_rlc_ue_manager
);
nr_rlc_ue_t
*
ue
=
nr_rlc_manager_get_ue
(
nr_rlc_ue_manager
,
rnti
);
if
(
ue
==
NULL
)
if
(
ue
==
NULL
)
{
LOG_E
(
RLC
,
"RLC instance for the given UE was not found
\n
"
);
return
;
}
nr_rlc_entity_t
*
rb
=
get_rlc_entity_from_lcid
(
ue
,
lc_id
);
if
(
rb
!=
NULL
)
{
...
...
@@ -644,7 +663,6 @@ void nr_rlc_reestablish_entity(int rnti, int lc_id)
}
nr_rlc_manager_unlock
(
nr_rlc_ue_manager
);
}
void
nr_rlc_reconfigure_entity
(
int
rnti
,
int
lc_id
,
NR_RLC_Config_t
*
rlc_Config
)
{
nr_rlc_manager_lock
(
nr_rlc_ue_manager
);
...
...
@@ -703,6 +721,18 @@ void nr_rlc_reconfigure_entity(int rnti, int lc_id, NR_RLC_Config_t *rlc_Config)
AssertFatal
(
um
->
ul_UM_RLC
.
sn_FieldLength
==
NULL
,
"Cannot handle different sn_FieldLength for DL and UL
\n
"
);
nr_rlc_entity_um_reconfigure
(
rb
,
t_reassembly
,
sn_field_length
);
}
}
else
{
AssertFatal
(
rb
->
stats
.
mode
==
NR_RLC_AM
,
"Invalid RLC mode
\n
"
);
// default values as in 9.2.1 of 38.331
int
sn_field_length
=
12
;
nr_rlc_entity_am_reconfigure
(
rb
,
45
,
//t_poll_retransmit
35
,
//t_reassembly
0
,
//t_status_prohibit
-
1
,
//poll_pdu
-
1
,
//poll_byte
8
,
//max_retx_threshold
&
sn_field_length
);
}
nr_rlc_manager_unlock
(
nr_rlc_ue_manager
);
}
...
...
openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h
View file @
6108e5b8
...
...
@@ -45,6 +45,7 @@ void nr_rlc_add_srb(int rnti, int srb_id, const NR_RLC_BearerConfig_t *rlc_Beare
void
nr_rlc_add_drb
(
int
rnti
,
int
drb_id
,
const
NR_RLC_BearerConfig_t
*
rlc_BearerConfig
);
void
nr_rlc_reestablish_entity
(
int
rnti
,
int
lc_id
);
logical_chan_id_t
nr_rlc_get_lcid_from_rb
(
int
ue_id
,
bool
is_srb
,
int
rb_id
);
void
nr_rlc_remove_ue
(
int
rnti
);
bool
nr_rlc_update_rnti
(
int
from_rnti
,
int
to_rnti
);
...
...
openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c
View file @
6108e5b8
...
...
@@ -1039,6 +1039,7 @@ static int handle_bcch_bch(NR_UE_MAC_INST_t *mac,
uint32_t
ssb_index
,
uint32_t
ssb_length
,
uint16_t
ssb_start_subcarrier
,
long
ssb_arfcn
,
uint16_t
cell_id
)
{
mac
->
mib_ssb
=
ssb_index
;
...
...
@@ -1048,7 +1049,8 @@ static int handle_bcch_bch(NR_UE_MAC_INST_t *mac,
mac
->
frequency_range
=
FR2
;
else
mac
->
frequency_range
=
FR1
;
nr_mac_rrc_data_ind_ue
(
mac
->
ue_id
,
cc_id
,
gNB_index
,
0
,
0
,
0
,
NR_BCCH_BCH
,
(
uint8_t
*
)
pduP
,
3
);
// fixed 3 bytes MIB PDU
// fixed 3 bytes MIB PDU
nr_mac_rrc_data_ind_ue
(
mac
->
ue_id
,
cc_id
,
gNB_index
,
0
,
0
,
0
,
cell_id
,
ssb_arfcn
,
NR_BCCH_BCH
,
(
uint8_t
*
)
pduP
,
3
);
return
0
;
}
...
...
@@ -1227,6 +1229,7 @@ static uint32_t nr_ue_dl_processing(nr_downlink_indication_t *dl_info)
rx_indication_body
.
ssb_pdu
.
ssb_index
,
rx_indication_body
.
ssb_pdu
.
ssb_length
,
rx_indication_body
.
ssb_pdu
.
ssb_start_subcarrier
,
rx_indication_body
.
ssb_pdu
.
arfcn
,
rx_indication_body
.
ssb_pdu
.
cell_id
))
<<
FAPI_NR_RX_PDU_TYPE_SSB
;
}
break
;
...
...
openair2/RRC/NR/MESSAGES/asn1_msg.c
View file @
6108e5b8
...
...
@@ -979,7 +979,10 @@ uint8_t do_NR_ULInformationTransfer(uint8_t **buffer, uint32_t pdu_length, uint8
return
encoded
;
}
uint8_t
do_RRCReestablishmentRequest
(
uint8_t
*
buffer
,
uint16_t
c_rnti
)
uint8_t
do_RRCReestablishmentRequest
(
uint8_t
*
buffer
,
NR_ReestablishmentCause_t
cause
,
uint32_t
cell_id
,
uint16_t
c_rnti
)
{
asn_enc_rval_t
enc_rval
;
NR_UL_CCCH_Message_t
ul_ccch_msg
;
...
...
@@ -994,16 +997,16 @@ uint8_t do_RRCReestablishmentRequest(uint8_t *buffer, uint16_t c_rnti)
rrcReestablishmentRequest
=
ul_ccch_msg
.
message
.
choice
.
c1
->
choice
.
rrcReestablishmentRequest
;
// test
rrcReestablishmentRequest
->
rrcReestablishmentRequest
.
reestablishmentCause
=
NR_ReestablishmentCause_reconfigurationFailur
e
;
rrcReestablishmentRequest
->
rrcReestablishmentRequest
.
reestablishmentCause
=
caus
e
;
rrcReestablishmentRequest
->
rrcReestablishmentRequest
.
ue_Identity
.
c_RNTI
=
c_rnti
;
rrcReestablishmentRequest
->
rrcReestablishmentRequest
.
ue_Identity
.
physCellId
=
0
;
rrcReestablishmentRequest
->
rrcReestablishmentRequest
.
ue_Identity
.
physCellId
=
cell_id
;
// TODO properly setting shortMAC-I (see 5.3.7.4 of 331)
rrcReestablishmentRequest
->
rrcReestablishmentRequest
.
ue_Identity
.
shortMAC_I
.
buf
=
buf
;
rrcReestablishmentRequest
->
rrcReestablishmentRequest
.
ue_Identity
.
shortMAC_I
.
buf
[
0
]
=
0x08
;
rrcReestablishmentRequest
->
rrcReestablishmentRequest
.
ue_Identity
.
shortMAC_I
.
buf
[
1
]
=
0x32
;
rrcReestablishmentRequest
->
rrcReestablishmentRequest
.
ue_Identity
.
shortMAC_I
.
size
=
2
;
if
(
LOG_DEBUGFLAG
(
DEBUG_ASN1
)
)
{
if
(
LOG_DEBUGFLAG
(
DEBUG_ASN1
))
{
xer_fprint
(
stdout
,
&
asn_DEF_NR_UL_CCCH_Message
,
(
void
*
)
&
ul_ccch_msg
);
}
...
...
openair2/RRC/NR/MESSAGES/asn1_msg.h
View file @
6108e5b8
...
...
@@ -131,7 +131,10 @@ uint8_t do_NR_ULInformationTransfer(uint8_t **buffer,
uint32_t
pdu_length
,
uint8_t
*
pdu_buffer
);
uint8_t
do_RRCReestablishmentRequest
(
uint8_t
*
buffer
,
uint16_t
c_rnti
);
uint8_t
do_RRCReestablishmentRequest
(
uint8_t
*
buffer
,
NR_ReestablishmentCause_t
cause
,
uint32_t
cell_id
,
uint16_t
c_rnti
);
int
do_RRCReestablishment
(
rrc_gNB_ue_context_t
*
const
ue_context_pP
,
uint8_t
*
const
buffer
,
...
...
openair2/RRC/NR_UE/L2_interface_ue.c
View file @
6108e5b8
...
...
@@ -54,6 +54,8 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
const
frame_t
frame
,
const
int
slot
,
const
rnti_t
rnti
,
const
uint32_t
cellid
,
const
long
arfcn
,
const
channel_t
channel
,
const
uint8_t
*
pduP
,
const
sdu_size_t
pdu_len
)
...
...
@@ -84,6 +86,8 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
NR_RRC_MAC_BCCH_DATA_IND
(
message_p
).
slot
=
slot
;
NR_RRC_MAC_BCCH_DATA_IND
(
message_p
).
sdu_size
=
sdu_size
;
NR_RRC_MAC_BCCH_DATA_IND
(
message_p
).
gnb_index
=
gNB_index
;
NR_RRC_MAC_BCCH_DATA_IND
(
message_p
).
phycellid
=
cellid
;
NR_RRC_MAC_BCCH_DATA_IND
(
message_p
).
ssb_arfcn
=
arfcn
;
NR_RRC_MAC_BCCH_DATA_IND
(
message_p
).
is_bch
=
(
channel
==
NR_BCCH_BCH
);
itti_send_msg_to_task
(
TASK_RRC_NRUE
,
GNB_MODULE_ID_TO_INSTANCE
(
module_id
),
message_p
);
}
...
...
@@ -122,10 +126,11 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
return
(
0
);
}
void
nr_mac_rrc_msg3_ind
(
const
module_id_t
mod_id
,
const
int
rnti
)
void
nr_mac_rrc_msg3_ind
(
const
module_id_t
mod_id
,
const
int
rnti
,
int
gnb_id
)
{
MessageDef
*
message_p
=
itti_alloc_new_message
(
TASK_MAC_UE
,
0
,
NR_RRC_MAC_MSG3_IND
);
NR_RRC_MAC_MSG3_IND
(
message_p
).
rnti
=
rnti
;
NR_RRC_MAC_MSG3_IND
(
message_p
).
gnb_id
=
gnb_id
;
itti_send_msg_to_task
(
TASK_RRC_NRUE
,
GNB_MODULE_ID_TO_INSTANCE
(
mod_id
),
message_p
);
}
...
...
openair2/RRC/NR_UE/rrc_UE.c
View file @
6108e5b8
This diff is collapsed.
Click to expand it.
openair2/RRC/NR_UE/rrc_defs.h
View file @
6108e5b8
...
...
@@ -56,6 +56,7 @@
#include "NR_UE-NR-Capability.h"
#include "NR_SL-PreconfigurationNR-r16.h"
#include "NR_MasterInformationBlockSidelink.h"
#include "NR_ReestablishmentCause.h"
#include "RRC/NR/nr_rrc_common.h"
#include "as_message.h"
...
...
@@ -85,8 +86,6 @@ typedef enum Rrc_State_NR_e {
RRC_STATE_INACTIVE_NR
,
RRC_STATE_CONNECTED_NR
,
RRC_STATE_DETACH_NR
,
RRC_STATE_FIRST_NR
=
RRC_STATE_IDLE_NR
,
RRC_STATE_LAST_NR
=
RRC_STATE_CONNECTED_NR
,
}
Rrc_State_NR_t
;
typedef
enum
requested_SI_List_e
{
...
...
@@ -187,10 +186,14 @@ typedef struct NR_UE_RRC_INST_s {
rrcPerNB_t
perNB
[
NB_CNX_UE
];
rnti_t
rnti
;
uint32_t
phyCellID
;
long
arfcn_ssb
;
OAI_NR_UECapability_t
UECap
;
NR_UE_Timers_Constants_t
timers_and_constants
;
RA_trigger_t
ra_trigger
;
NR_ReestablishmentCause_t
reestablishment_cause
;
plmn_t
plmnID
;
NR_BWP_Id_t
dl_bwp_id
;
...
...
openair2/RRC/NR_UE/rrc_proto.h
View file @
6108e5b8
...
...
@@ -73,6 +73,8 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
const
frame_t
frame
,
const
int
slot
,
const
rnti_t
rnti
,
const
uint32_t
cellid
,
const
long
arfcn
,
const
channel_t
channel
,
const
uint8_t
*
pduP
,
const
sdu_size_t
pdu_len
);
...
...
@@ -86,7 +88,8 @@ void nr_rrc_going_to_IDLE(NR_UE_RRC_INST_t *rrc,
NR_RRCRelease_t
*
RRCRelease
);
void
nr_mac_rrc_ra_ind
(
const
module_id_t
mod_id
,
int
frame
,
bool
success
);
void
nr_mac_rrc_msg3_ind
(
const
module_id_t
mod_id
,
const
int
rnti
);
void
nr_mac_rrc_msg3_ind
(
const
module_id_t
mod_id
,
const
int
rnti
,
int
gnb_id
);
void
set_rlf_sib1_timers_and_constants
(
NR_UE_Timers_Constants_t
*
tac
,
NR_SIB1_t
*
sib1
);
/**\brief RRC UE task.
\param void *args_p Pointer on arguments to start the task. */
...
...
openair2/RRC/NR_UE/rrc_timers_and_constants.c
View file @
6108e5b8
...
...
@@ -121,10 +121,18 @@ void nr_rrc_handle_timers(NR_UE_RRC_INST_t *rrc)
bool
t300_expired
=
nr_timer_tick
(
&
timers
->
T300
);
if
(
t300_expired
)
{
LOG_W
(
NR_RRC
,
"Timer T300 expired
\n
"
);
LOG_W
(
NR_RRC
,
"Timer T300 expired
! No timely response to RRCSetupRequest
\n
"
);
handle_t300_expiry
(
rrc
);
}
bool
t301_expired
=
nr_timer_tick
(
&
timers
->
T301
);
// Upon T301 expiry, the UE shall perform the actions upon going to RRC_IDLE
// with release cause 'RRC connection failure'
if
(
t301_expired
)
{
LOG_W
(
NR_RRC
,
"Timer T301 expired! No timely response to RRCReestabilshmentRequest
\n
"
);
nr_rrc_going_to_IDLE
(
rrc
,
RRC_CONNECTION_FAILURE
,
NULL
);
}
bool
t304_expired
=
nr_timer_tick
(
&
timers
->
T304
);
if
(
t304_expired
)
{
LOG_W
(
NR_RRC
,
"Timer T304 expired
\n
"
);
...
...
@@ -146,7 +154,7 @@ void nr_rrc_handle_timers(NR_UE_RRC_INST_t *rrc)
bool
t311_expired
=
nr_timer_tick
(
&
timers
->
T311
);
if
(
t311_expired
)
{
LOG_W
(
NR_RRC
,
"Timer T311 expired
\n
"
);
LOG_W
(
NR_RRC
,
"Timer T311 expired
! No suitable cell found in time after initiation of re-establishment
\n
"
);
// Upon T311 expiry, the UE shall perform the actions upon going to RRC_IDLE
// with release cause 'RRC connection failure'
nr_rrc_going_to_IDLE
(
rrc
,
RRC_CONNECTION_FAILURE
,
NULL
);
...
...
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