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
78041a20
Commit
78041a20
authored
Dec 01, 2023
by
francescomani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rework BWP UE structures including handling of need codes
parent
ce35b668
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1451 additions
and
417 deletions
+1451
-417
openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c
openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c
+3
-39
openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h
openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h
+0
-6
openair2/LAYER2/NR_MAC_UE/config_ue.c
openair2/LAYER2/NR_MAC_UE/config_ue.c
+1286
-270
openair2/LAYER2/NR_MAC_UE/mac_defs.h
openair2/LAYER2/NR_MAC_UE/mac_defs.h
+16
-13
openair2/LAYER2/NR_MAC_UE/mac_proto.h
openair2/LAYER2/NR_MAC_UE/mac_proto.h
+15
-0
openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
+13
-13
openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c
openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c
+34
-33
openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
+27
-22
openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
+20
-21
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
+37
-0
No files found.
openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c
View file @
78041a20
...
...
@@ -608,7 +608,9 @@ NR_tda_info_t get_dl_tda_info(const NR_UE_DL_BWP_t *dl_BWP, int ss_type, int tda
int
mux_pattern
,
nr_rnti_type_t
rnti_type
,
int
coresetid
,
bool
sib1
)
{
NR_tda_info_t
tda_info
;
bool
normal_CP
=
dl_BWP
->
cyclicprefix
?
false
:
true
;
bool
normal_CP
=
true
;
if
(
dl_BWP
&&
dl_BWP
->
cyclicprefix
)
normal_CP
=
false
;
// implements Table 5.1.2.1.1-1 of 38.214
NR_PDSCH_TimeDomainResourceAllocationList_t
*
tdalist
=
get_dl_tdalist
(
dl_BWP
,
coresetid
,
ss_type
,
rnti_type
);
switch
(
rnti_type
)
{
...
...
@@ -3708,7 +3710,6 @@ int16_t fill_dmrs_mask(const NR_PDSCH_Config_t *pdsch_Config,
mappingType_t
mappingtype
,
int
length
)
{
int
dmrs_AdditionalPosition
=
0
;
NR_DMRS_DownlinkConfig_t
*
dmrs_config
=
NULL
;
...
...
@@ -4729,43 +4730,6 @@ uint16_t compute_pucch_prb_size(uint8_t format,
return
0
;
}
int
get_dlbw_tbslbrm
(
int
scc_bwpsize
,
const
NR_ServingCellConfig_t
*
servingCellConfig
)
{
int
bw
=
scc_bwpsize
;
if
(
servingCellConfig
)
{
if
(
servingCellConfig
->
downlinkBWP_ToAddModList
)
{
const
struct
NR_ServingCellConfig__downlinkBWP_ToAddModList
*
BWP_list
=
servingCellConfig
->
downlinkBWP_ToAddModList
;
for
(
int
i
=
0
;
i
<
BWP_list
->
list
.
count
;
i
++
)
{
NR_BWP_t
genericParameters
=
BWP_list
->
list
.
array
[
i
]
->
bwp_Common
->
genericParameters
;
int
curr_bw
=
NRRIV2BW
(
genericParameters
.
locationAndBandwidth
,
MAX_BWP_SIZE
);
if
(
curr_bw
>
bw
)
bw
=
curr_bw
;
}
}
}
return
bw
;
}
int
get_ulbw_tbslbrm
(
int
scc_bwpsize
,
const
NR_ServingCellConfig_t
*
servingCellConfig
)
{
int
bw
=
scc_bwpsize
;
if
(
servingCellConfig
)
{
if
(
servingCellConfig
->
uplinkConfig
&&
servingCellConfig
->
uplinkConfig
->
uplinkBWP_ToAddModList
)
{
const
struct
NR_UplinkConfig__uplinkBWP_ToAddModList
*
BWP_list
=
servingCellConfig
->
uplinkConfig
->
uplinkBWP_ToAddModList
;
for
(
int
i
=
0
;
i
<
BWP_list
->
list
.
count
;
i
++
)
{
NR_BWP_t
genericParameters
=
BWP_list
->
list
.
array
[
i
]
->
bwp_Common
->
genericParameters
;
int
curr_bw
=
NRRIV2BW
(
genericParameters
.
locationAndBandwidth
,
MAX_BWP_SIZE
);
if
(
curr_bw
>
bw
)
bw
=
curr_bw
;
}
}
}
return
bw
;
}
/* extract UL PTRS values from RRC and validate it based upon 38.214 6.2.3 */
bool
set_ul_ptrs_values
(
NR_PTRS_UplinkConfig_t
*
ul_ptrs_config
,
uint16_t
rbSize
,
uint8_t
mcsIndex
,
uint8_t
mcsTable
,
...
...
openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h
View file @
78041a20
...
...
@@ -196,12 +196,6 @@ uint32_t nr_get_code_rate_ul(uint8_t Imcs, uint8_t table_idx);
uint16_t
get_nr_srs_offset
(
NR_SRS_PeriodicityAndOffset_t
periodicityAndOffset
);
int
get_dlbw_tbslbrm
(
int
scc_bwpsize
,
const
NR_ServingCellConfig_t
*
servingCellConfig
);
int
get_ulbw_tbslbrm
(
int
scc_bwpsize
,
const
NR_ServingCellConfig_t
*
servingCellConfig
);
uint32_t
nr_compute_tbslbrm
(
uint16_t
table
,
uint16_t
nb_rb
,
uint8_t
Nl
);
...
...
openair2/LAYER2/NR_MAC_UE/config_ue.c
View file @
78041a20
This diff is collapsed.
Click to expand it.
openair2/LAYER2/NR_MAC_UE/mac_defs.h
View file @
78041a20
...
...
@@ -432,6 +432,17 @@ typedef struct nr_lcordered_info_s {
NR_LogicalChannelConfig_t
*
logicalChannelConfig_ordered
;
}
nr_lcordered_info_t
;
typedef
struct
{
NR_SearchSpace_t
*
otherSI_SS
;
NR_SearchSpace_t
*
ra_SS
;
NR_SearchSpace_t
*
paging_SS
;
NR_ControlResourceSet_t
*
coreset0
;
NR_ControlResourceSet_t
*
commonControlResourceSet
;
NR_SearchSpace_t
*
search_space_zero
;
A_SEQUENCE_OF
(
NR_ControlResourceSet_t
)
list_Coreset
;
A_SEQUENCE_OF
(
NR_SearchSpace_t
)
list_SS
;
}
NR_BWP_PDCCH_t
;
/*!\brief Top level UE MAC structure */
typedef
struct
{
NR_UE_L2_STATE_t
state
;
...
...
@@ -446,24 +457,16 @@ typedef struct {
ssb_list_info_t
ssb_list
;
NR_UE_ServingCell_Info_t
sc_info
;
NR_UE_DL_BWP_t
current_DL_BWP
;
NR_UE_UL_BWP_t
current_UL_BWP
;
NR_BWP_DownlinkCommon_t
*
bwp_dlcommon
;
NR_BWP_UplinkCommon_t
*
bwp_ulcommon
;
A_SEQUENCE_OF
(
NR_UE_DL_BWP_t
)
dl_BWPs
;
A_SEQUENCE_OF
(
NR_UE_UL_BWP_t
)
ul_BWPs
;
NR_BWP_PDCCH_t
config_BWP_PDCCH
[
5
];
NR_UE_DL_BWP_t
*
current_DL_BWP
;
NR_UE_UL_BWP_t
*
current_UL_BWP
;
bool
harq_ACK_SpatialBundlingPUCCH
;
bool
harq_ACK_SpatialBundlingPUSCH
;
NR_UL_TIME_ALIGNMENT_t
ul_time_alignment
;
NR_SearchSpace_t
*
otherSI_SS
;
NR_SearchSpace_t
*
ra_SS
;
NR_SearchSpace_t
*
paging_SS
;
NR_ControlResourceSet_t
*
BWP_coresets
[
FAPI_NR_MAX_CORESET_PER_BWP
];
NR_ControlResourceSet_t
*
coreset0
;
NR_SearchSpace_t
*
BWP_searchspaces
[
FAPI_NR_MAX_SS
];
NR_SearchSpace_t
*
search_space_zero
;
NR_TDD_UL_DL_ConfigCommon_t
*
tdd_UL_DL_ConfigurationCommon
;
bool
phy_config_request_sent
;
...
...
openair2/LAYER2/NR_MAC_UE/mac_proto.h
View file @
78041a20
...
...
@@ -56,6 +56,21 @@
type); \
} \
#define handleMACsetupreleaseElement(destination, origin, type, asn_DEF) { \
if (origin->present == 1) { \
ASN_STRUCT_FREE(asn_DEF, destination); \
destination = NULL; \
} \
if (origin->present == 2) { \
if (!destination) \
destination = calloc(1, sizeof(*destination)); \
destination->present = origin->present; \
updateMACie(destination->choice.setup, \
origin->choice.setup, \
type); \
} \
} \
/**\brief initialize the field in nr_mac instance
\param module_id module id */
void
nr_ue_init_mac
(
module_id_t
module_idP
);
...
...
openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
View file @
78041a20
...
...
@@ -77,8 +77,8 @@ void init_RA(module_id_t mod_id,
prach_resources
->
RA_PREAMBLE_BACKOFF
=
0
;
NR_SubcarrierSpacing_t
prach_scs
=
*
nr_rach_ConfigCommon
->
msg1_SubcarrierSpacing
;
int
n_prbs
=
get_N_RA_RB
(
prach_scs
,
mac
->
current_UL_BWP
.
scs
);
int
start_prb
=
rach_ConfigGeneric
->
msg1_FrequencyStart
+
mac
->
current_UL_BWP
.
BWPStart
;
int
n_prbs
=
get_N_RA_RB
(
prach_scs
,
mac
->
current_UL_BWP
->
scs
);
int
start_prb
=
rach_ConfigGeneric
->
msg1_FrequencyStart
+
mac
->
current_UL_BWP
->
BWPStart
;
// PRACH shall be as specified for QPSK modulated DFT-s-OFDM of equivalent RB allocation (38.101-1)
prach_resources
->
RA_PCMAX
=
nr_get_Pcmax
(
mac
,
2
,
false
,
prach_scs
,
cfg
->
carrier_config
.
dl_grid_size
[
prach_scs
],
true
,
n_prbs
,
start_prb
);
prach_resources
->
RA_PREAMBLE_TRANSMISSION_COUNTER
=
1
;
...
...
@@ -172,7 +172,7 @@ void init_RA(module_id_t mod_id,
int8_t
nr_get_DELTA_PREAMBLE
(
module_id_t
mod_id
,
int
CC_id
,
uint16_t
prach_format
)
{
NR_UE_MAC_INST_t
*
mac
=
get_mac_inst
(
mod_id
);
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
;
NR_SubcarrierSpacing_t
scs
=
*
nr_rach_ConfigCommon
->
msg1_SubcarrierSpacing
;
int
prach_sequence_length
=
nr_rach_ConfigCommon
->
prach_RootSequenceIndex
.
present
-
1
;
uint8_t
prachConfigIndex
,
mu
;
...
...
@@ -278,7 +278,7 @@ int nr_get_Po_NOMINAL_PUSCH(NR_PRACH_RESOURCES_t *prach_resources, module_id_t m
int8_t
receivedTargerPower
;
int8_t
delta_preamble
;
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
preambleReceivedTargetPower
=
nr_rach_ConfigCommon
->
rach_ConfigGeneric
.
preambleReceivedTargetPower
;
delta_preamble
=
nr_get_DELTA_PREAMBLE
(
mod_id
,
CC_id
,
prach_resources
->
prach_format
);
...
...
@@ -383,11 +383,11 @@ void ra_preambles_config(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t
}
RA_config_t
*
ra
=
&
mac
->
ra
;
NR_RACH_ConfigCommon_t
*
setup
=
mac
->
current_UL_BWP
.
rach_ConfigCommon
;
NR_RACH_ConfigCommon_t
*
setup
=
mac
->
current_UL_BWP
->
rach_ConfigCommon
;
NR_RACH_ConfigGeneric_t
*
rach_ConfigGeneric
=
&
setup
->
rach_ConfigGeneric
;
if
(
mac
->
current_UL_BWP
.
msg3_DeltaPreamble
)
{
deltaPreamble_Msg3
=
(
*
mac
->
current_UL_BWP
.
msg3_DeltaPreamble
)
*
2
;
// dB
if
(
mac
->
current_UL_BWP
->
msg3_DeltaPreamble
)
{
deltaPreamble_Msg3
=
(
*
mac
->
current_UL_BWP
->
msg3_DeltaPreamble
)
*
2
;
// dB
LOG_D
(
MAC
,
"In %s: deltaPreamble_Msg3 set to %ld
\n
"
,
__FUNCTION__
,
deltaPreamble_Msg3
);
}
...
...
@@ -552,7 +552,7 @@ void nr_get_prach_resources(module_id_t mod_id,
NR_UE_MAC_INST_t
*
mac
=
get_mac_inst
(
mod_id
);
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
;
LOG_D
(
MAC
,
"In %s: getting PRACH resources frame (first_Msg3 %d)
\n
"
,
__FUNCTION__
,
ra
->
first_Msg3
);
...
...
@@ -590,8 +590,8 @@ void nr_Msg3_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, slot
NR_UE_MAC_INST_t
*
mac
=
get_mac_inst
(
mod_id
);
RA_config_t
*
ra
=
&
mac
->
ra
;
NR_RACH_ConfigCommon_t
*
nr_rach_ConfigCommon
=
mac
->
current_UL_BWP
.
rach_ConfigCommon
;
long
mu
=
mac
->
current_UL_BWP
.
scs
;
NR_RACH_ConfigCommon_t
*
nr_rach_ConfigCommon
=
mac
->
current_UL_BWP
->
rach_ConfigCommon
;
long
mu
=
mac
->
current_UL_BWP
->
scs
;
int
subframes_per_slot
=
nr_slots_per_frame
[
mu
]
/
10
;
// start contention resolution timer (cnt in slots)
...
...
@@ -699,7 +699,7 @@ uint8_t nr_ue_get_rach(module_id_t mod_id,
if
(
ra
->
ra_state
>
RA_UE_IDLE
&&
ra
->
ra_state
<
RA_SUCCEEDED
)
{
if
(
ra
->
RA_active
==
0
)
{
NR_RACH_ConfigCommon_t
*
setup
=
mac
->
current_UL_BWP
.
rach_ConfigCommon
;
NR_RACH_ConfigCommon_t
*
setup
=
mac
->
current_UL_BWP
->
rach_ConfigCommon
;
NR_RACH_ConfigGeneric_t
*
rach_ConfigGeneric
=
&
setup
->
rach_ConfigGeneric
;
init_RA
(
mod_id
,
&
ra
->
prach_resources
,
setup
,
rach_ConfigGeneric
,
ra
->
rach_ConfigDedicated
);
...
...
@@ -821,12 +821,12 @@ uint8_t nr_ue_get_rach(module_id_t mod_id,
void
nr_get_RA_window
(
NR_UE_MAC_INST_t
*
mac
)
{
RA_config_t
*
ra
=
&
mac
->
ra
;
NR_RACH_ConfigCommon_t
*
setup
=
mac
->
current_UL_BWP
.
rach_ConfigCommon
;
NR_RACH_ConfigCommon_t
*
setup
=
mac
->
current_UL_BWP
->
rach_ConfigCommon
;
AssertFatal
(
&
setup
->
rach_ConfigGeneric
!=
NULL
,
"In %s: FATAL! rach_ConfigGeneric is NULL...
\n
"
,
__FUNCTION__
);
NR_RACH_ConfigGeneric_t
*
rach_ConfigGeneric
=
&
setup
->
rach_ConfigGeneric
;
int
ra_ResponseWindow
=
rach_ConfigGeneric
->
ra_ResponseWindow
;
int
mu
=
mac
->
current_DL_BWP
.
scs
;
int
mu
=
mac
->
current_DL_BWP
->
scs
;
ra
->
RA_window_cnt
=
ra
->
RA_offset
*
nr_slots_per_frame
[
mu
];
// taking into account the 2 frames gap introduced by OAI gNB
...
...
openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c
View file @
78041a20
...
...
@@ -86,13 +86,15 @@ void fill_dci_search_candidates(const NR_SearchSpace_t *ss,
rel15
->
number_of_candidates
=
i
;
}
NR_ControlResourceSet_t
*
ue_get_coreset
(
const
NR_
UE_MAC_INST_t
*
mac
,
const
int
coreset_id
)
NR_ControlResourceSet_t
*
ue_get_coreset
(
const
NR_
BWP_PDCCH_t
*
config
,
const
int
coreset_id
)
{
if
(
config
->
commonControlResourceSet
&&
coreset_id
==
config
->
commonControlResourceSet
->
controlResourceSetId
)
return
config
->
commonControlResourceSet
;
NR_ControlResourceSet_t
*
coreset
=
NULL
;
for
(
int
i
=
0
;
i
<
FAPI_NR_MAX_CORESET_PER_BWP
;
i
++
)
{
if
(
mac
->
BWP_coresets
[
i
]
!=
NULL
&&
mac
->
BWP_coresets
[
i
]
->
controlResourceSetId
==
coreset_id
)
{
coreset
=
mac
->
BWP_coresets
[
i
];
for
(
int
i
=
0
;
i
<
config
->
list_Coreset
.
count
;
i
++
)
{
if
(
config
->
list_Coreset
.
array
[
i
]
->
controlResourceSetId
==
coreset_id
)
{
coreset
=
config
->
list_Coreset
.
array
[
i
];
break
;
}
}
...
...
@@ -108,19 +110,20 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac,
const
NR_SearchSpace_t
*
ss
)
{
const
NR_UE_DL_BWP_t
*
current_DL_BWP
=
&
mac
->
current_DL_BWP
;
const
NR_UE_UL_BWP_t
*
current_UL_BWP
=
&
mac
->
current_UL_BWP
;
const
NR_UE_DL_BWP_t
*
current_DL_BWP
=
mac
->
current_DL_BWP
;
const
NR_UE_UL_BWP_t
*
current_UL_BWP
=
mac
->
current_UL_BWP
;
NR_BWP_Id_t
dl_bwp_id
=
current_DL_BWP
?
current_DL_BWP
->
bwp_id
:
0
;
NR_BWP_PDCCH_t
*
pdcch_config
=
&
mac
->
config_BWP_PDCCH
[
dl_bwp_id
];
fapi_nr_dl_config_dci_dl_pdu_rel15_t
*
rel15
=
&
dl_config
->
dl_config_list
[
dl_config
->
number_pdus
].
dci_config_pdu
.
dci_config_rel15
;
const
int
coreset_id
=
*
ss
->
controlResourceSetId
;
NR_ControlResourceSet_t
*
coreset
;
if
(
coreset_id
>
0
)
{
coreset
=
ue_get_coreset
(
mac
,
coreset_id
);
coreset
=
ue_get_coreset
(
pdcch_config
,
coreset_id
);
rel15
->
coreset
.
CoreSetType
=
NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG
;
}
else
{
coreset
=
mac
->
coreset0
;
coreset
=
pdcch_config
->
coreset0
;
rel15
->
coreset
.
CoreSetType
=
NFAPI_NR_CSET_CONFIG_MIB_SIB1
;
}
...
...
@@ -460,8 +463,10 @@ bool monitior_dci_for_other_SI(NR_UE_MAC_INST_t *mac,
void
ue_dci_configuration
(
NR_UE_MAC_INST_t
*
mac
,
fapi_nr_dl_config_request_t
*
dl_config
,
const
frame_t
frame
,
const
int
slot
)
{
const
NR_UE_DL_BWP_t
*
current_DL_BWP
=
&
mac
->
current_DL_BWP
;
int
scs
=
mac
->
get_sib1
?
get_softmodem_params
()
->
numerology
:
current_DL_BWP
->
scs
;
const
NR_UE_DL_BWP_t
*
current_DL_BWP
=
mac
->
current_DL_BWP
;
NR_BWP_Id_t
dl_bwp_id
=
current_DL_BWP
?
current_DL_BWP
->
bwp_id
:
0
;
NR_BWP_PDCCH_t
*
pdcch_config
=
&
mac
->
config_BWP_PDCCH
[
dl_bwp_id
];
int
scs
=
current_DL_BWP
?
current_DL_BWP
->
scs
:
get_softmodem_params
()
->
numerology
;
const
int
slots_per_frame
=
nr_slots_per_frame
[
scs
];
if
(
mac
->
get_sib1
)
{
int
ssb_sc_offset_norm
;
...
...
@@ -483,22 +488,22 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
mac
->
mib_ssb
,
1
,
// If the UE is not configured with a periodicity, the UE assumes a periodicity of a half frame
ssb_offset_point_a
);
if
(
mac
->
search_space_zero
==
NULL
)
mac
->
search_space_zero
=
calloc
(
1
,
sizeof
(
*
mac
->
search_space_zero
));
if
(
mac
->
coreset0
==
NULL
)
mac
->
coreset0
=
calloc
(
1
,
sizeof
(
*
mac
->
coreset0
));
fill_coresetZero
(
mac
->
coreset0
,
&
mac
->
type0_PDCCH_CSS_config
);
fill_searchSpaceZero
(
mac
->
search_space_zero
,
slots_per_frame
,
&
mac
->
type0_PDCCH_CSS_config
);
if
(
is_ss_monitor_occasion
(
frame
,
slot
,
slots_per_frame
,
mac
->
search_space_zero
))
{
if
(
pdcch_config
->
search_space_zero
==
NULL
)
pdcch_config
->
search_space_zero
=
calloc
(
1
,
sizeof
(
*
pdcch_config
->
search_space_zero
));
if
(
pdcch_config
->
coreset0
==
NULL
)
pdcch_config
->
coreset0
=
calloc
(
1
,
sizeof
(
*
pdcch_config
->
coreset0
));
fill_coresetZero
(
pdcch_config
->
coreset0
,
&
mac
->
type0_PDCCH_CSS_config
);
fill_searchSpaceZero
(
pdcch_config
->
search_space_zero
,
slots_per_frame
,
&
mac
->
type0_PDCCH_CSS_config
);
if
(
is_ss_monitor_occasion
(
frame
,
slot
,
slots_per_frame
,
pdcch_config
->
search_space_zero
))
{
LOG_D
(
NR_MAC
,
"Monitoring DCI for SIB1 in frame %d slot %d
\n
"
,
frame
,
slot
);
config_dci_pdu
(
mac
,
dl_config
,
NR_RNTI_SI
,
slot
,
mac
->
search_space_zero
);
config_dci_pdu
(
mac
,
dl_config
,
NR_RNTI_SI
,
slot
,
pdcch_config
->
search_space_zero
);
}
}
if
(
mac
->
get_otherSI
)
{
// If searchSpaceOtherSystemInformation is set to zero,
// PDCCH monitoring occasions for SI message reception in SI-window
// are same as PDCCH monitoring occasions for SIB1
const
NR_SearchSpace_t
*
ss
=
mac
->
otherSI_SS
?
mac
->
otherSI_SS
:
mac
->
search_space_zero
;
const
NR_SearchSpace_t
*
ss
=
pdcch_config
->
otherSI_SS
?
pdcch_config
->
otherSI_SS
:
pdcch_config
->
search_space_zero
;
// TODO configure SI-window
if
(
monitior_dci_for_other_SI
(
mac
,
ss
,
slots_per_frame
,
frame
,
slot
))
{
LOG_D
(
NR_MAC
,
"Monitoring DCI for other SIs in frame %d slot %d
\n
"
,
frame
,
slot
);
...
...
@@ -508,28 +513,24 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
if
(
mac
->
state
==
UE_PERFORMING_RA
&&
mac
->
ra
.
ra_state
>=
WAIT_RAR
)
{
// if RA is ongoing use RA search space
if
(
is_ss_monitor_occasion
(
frame
,
slot
,
slots_per_frame
,
mac
->
ra_SS
))
{
if
(
is_ss_monitor_occasion
(
frame
,
slot
,
slots_per_frame
,
pdcch_config
->
ra_SS
))
{
int
rnti_type
=
mac
->
ra
.
ra_state
==
WAIT_RAR
?
NR_RNTI_RA
:
NR_RNTI_TC
;
config_dci_pdu
(
mac
,
dl_config
,
rnti_type
,
slot
,
mac
->
ra_SS
);
config_dci_pdu
(
mac
,
dl_config
,
rnti_type
,
slot
,
pdcch_config
->
ra_SS
);
}
}
else
if
(
mac
->
state
==
UE_CONNECTED
)
{
bool
found
=
false
;
for
(
int
i
=
0
;
i
<
FAPI_NR_MAX_SS
;
i
++
)
{
if
(
mac
->
BWP_searchspaces
[
i
]
!=
NULL
)
{
found
=
true
;
NR_SearchSpace_t
*
ss
=
mac
->
BWP_searchspaces
[
i
];
if
(
is_ss_monitor_occasion
(
frame
,
slot
,
slots_per_frame
,
ss
))
config_dci_pdu
(
mac
,
dl_config
,
NR_RNTI_C
,
slot
,
ss
);
}
for
(
int
i
=
0
;
i
<
pdcch_config
->
list_SS
.
count
;
i
++
)
{
NR_SearchSpace_t
*
ss
=
pdcch_config
->
list_SS
.
array
[
i
];
if
(
is_ss_monitor_occasion
(
frame
,
slot
,
slots_per_frame
,
ss
))
config_dci_pdu
(
mac
,
dl_config
,
NR_RNTI_C
,
slot
,
ss
);
}
if
(
!
found
&&
mac
->
ra_SS
)
{
if
(
pdcch_config
->
list_SS
.
count
==
0
&&
pdcch_config
->
ra_SS
)
{
// If the UE has not been provided a Type3-PDCCH CSS set or a USS set and
// the UE has received a C-RNTI and has been provided a Type1-PDCCH CSS set,
// the UE monitors PDCCH candidates for DCI format 0_0 and DCI format 1_0
// with CRC scrambled by the C-RNTI in the Type1-PDCCH CSS set
if
(
is_ss_monitor_occasion
(
frame
,
slot
,
slots_per_frame
,
mac
->
ra_SS
))
config_dci_pdu
(
mac
,
dl_config
,
NR_RNTI_C
,
slot
,
mac
->
ra_SS
);
if
(
is_ss_monitor_occasion
(
frame
,
slot
,
slots_per_frame
,
pdcch_config
->
ra_SS
))
config_dci_pdu
(
mac
,
dl_config
,
NR_RNTI_C
,
slot
,
pdcch_config
->
ra_SS
);
}
}
}
openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
View file @
78041a20
...
...
@@ -171,8 +171,6 @@ void nr_ue_init_mac(module_id_t module_idP)
mac
->
state
=
UE_NOT_SYNC
;
mac
->
si_window_start
=
-
1
;
mac
->
servCellIndex
=
0
;
memset
(
&
mac
->
current_DL_BWP
,
0
,
sizeof
(
mac
->
current_DL_BWP
));
memset
(
&
mac
->
current_UL_BWP
,
0
,
sizeof
(
mac
->
current_UL_BWP
));
}
void
nr_ue_mac_default_configs
(
NR_UE_MAC_INST_t
*
mac
)
...
...
@@ -426,7 +424,7 @@ static int nr_ue_process_dci_ul_00(module_id_t module_id,
// Schedule PUSCH
const
int
coreset_type
=
dci_ind
->
coreset_type
==
NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG
;
// 0 for coreset0, 1 otherwise;
NR_tda_info_t
tda_info
=
get_ul_tda_info
(
&
mac
->
current_UL_BWP
,
NR_tda_info_t
tda_info
=
get_ul_tda_info
(
mac
->
current_UL_BWP
,
coreset_type
,
dci_ind
->
ss_type
,
get_rnti_type
(
mac
,
dci_ind
->
rnti
),
...
...
@@ -513,7 +511,7 @@ static int nr_ue_process_dci_ul_01(module_id_t module_id,
int
slot_tx
;
const
int
coreset_type
=
dci_ind
->
coreset_type
==
NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG
;
// 0 for coreset0, 1 otherwise;
NR_tda_info_t
tda_info
=
get_ul_tda_info
(
&
mac
->
current_UL_BWP
,
NR_tda_info_t
tda_info
=
get_ul_tda_info
(
mac
->
current_UL_BWP
,
coreset_type
,
dci_ind
->
ss_type
,
get_rnti_type
(
mac
,
dci_ind
->
rnti
),
...
...
@@ -614,7 +612,7 @@ static int nr_ue_process_dci_dl_10(module_id_t module_id,
fapi_nr_dl_config_dlsch_pdu_rel15_t
*
dlsch_pdu
=
&
dl_conf_req
->
dlsch_config_pdu
.
dlsch_config_rel15
;
dlsch_pdu
->
pduBitmap
=
0
;
NR_UE_DL_BWP_t
*
current_DL_BWP
=
&
mac
->
current_DL_BWP
;
NR_UE_DL_BWP_t
*
current_DL_BWP
=
mac
->
current_DL_BWP
;
NR_PDSCH_Config_t
*
pdsch_config
=
(
current_DL_BWP
||
!
mac
->
get_sib1
)
?
current_DL_BWP
->
pdsch_Config
:
NULL
;
if
(
dci_ind
->
ss_type
==
NR_SearchSpace__searchSpaceType_PR_common
)
{
dlsch_pdu
->
BWPSize
=
...
...
@@ -738,7 +736,7 @@ static int nr_ue_process_dci_dl_10(module_id_t module_id,
dlsch_pdu
->
TBS
=
current_harq
->
TBS
;
}
int
bw_tbslbrm
=
current_DL_BWP
->
initial_BWPSize
>
0
?
int
bw_tbslbrm
=
current_DL_BWP
?
current_DL_BWP
->
bw_tbslbrm
:
dlsch_pdu
->
BWPSize
;
dlsch_pdu
->
tbslbrm
=
nr_compute_tbslbrm
(
dlsch_pdu
->
mcs_table
,
bw_tbslbrm
,
1
);
...
...
@@ -767,7 +765,7 @@ static int nr_ue_process_dci_dl_10(module_id_t module_id,
dlsch_pdu
->
accumulated_delta_PUCCH
=
tcp
[
dci
->
tpc
];
// Sanity check for pucch_resource_indicator value received to check for false DCI.
bool
valid
=
false
;
NR_PUCCH_Config_t
*
pucch_Config
=
mac
->
current_UL_BWP
.
pucch_Config
;
NR_PUCCH_Config_t
*
pucch_Config
=
mac
->
current_UL_BWP
?
mac
->
current_UL_BWP
->
pucch_Config
:
NULL
;
if
(
pucch_Config
&&
pucch_Config
->
resourceSetToAddModList
)
{
int
pucch_res_set_cnt
=
pucch_Config
->
resourceSetToAddModList
->
list
.
count
;
...
...
@@ -897,7 +895,7 @@ static int nr_ue_process_dci_dl_11(module_id_t module_id,
dci
->
bwp_indicator
.
val
);
return
-
1
;
}
NR_UE_DL_BWP_t
*
current_DL_BWP
=
&
mac
->
current_DL_BWP
;
NR_UE_DL_BWP_t
*
current_DL_BWP
=
mac
->
current_DL_BWP
;
NR_PDSCH_Config_t
*
pdsch_Config
=
current_DL_BWP
->
pdsch_Config
;
fapi_nr_dl_config_request_t
*
dl_config
=
get_dl_config_request
(
mac
,
slot
);
fapi_nr_dl_config_request_pdu_t
*
dl_conf_req
=
&
dl_config
->
dl_config_list
[
dl_config
->
number_pdus
];
...
...
@@ -1005,7 +1003,7 @@ static int nr_ue_process_dci_dl_11(module_id_t module_id,
// Sanity check for pucch_resource_indicator value received to check for false DCI.
bool
valid
=
false
;
NR_PUCCH_Config_t
*
pucch_Config
=
mac
->
current_UL_BWP
.
pucch_Config
;
NR_PUCCH_Config_t
*
pucch_Config
=
mac
->
current_UL_BWP
->
pucch_Config
;
int
pucch_res_set_cnt
=
pucch_Config
->
resourceSetToAddModList
->
list
.
count
;
for
(
int
id
=
0
;
id
<
pucch_res_set_cnt
;
id
++
)
{
if
(
dci
->
pucch_resource_indicator
<
pucch_Config
->
resourceSetToAddModList
->
list
.
array
[
id
]
->
resourceList
.
list
.
count
)
{
...
...
@@ -1276,7 +1274,8 @@ void set_harq_status(NR_UE_MAC_INST_t *mac,
current_harq
->
N_CCE
=
N_CCE
;
current_harq
->
delta_pucch
=
delta_pucch
;
// FIXME k0 != 0 currently not taken into consideration
int
slots_per_frame
=
nr_slots_per_frame
[
mac
->
current_DL_BWP
.
scs
];
int
scs
=
mac
->
current_DL_BWP
?
mac
->
current_DL_BWP
->
scs
:
get_softmodem_params
()
->
numerology
;
int
slots_per_frame
=
nr_slots_per_frame
[
scs
];
current_harq
->
ul_frame
=
frame
;
current_harq
->
ul_slot
=
slot
+
data_toul_fb
;
if
(
current_harq
->
ul_slot
>=
slots_per_frame
)
{
...
...
@@ -1314,7 +1313,7 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac,
PUCCH_sched_t
*
pucch
,
fapi_nr_ul_config_pucch_pdu
*
pucch_pdu
)
{
NR_UE_UL_BWP_t
*
current_UL_BWP
=
&
mac
->
current_UL_BWP
;
NR_UE_UL_BWP_t
*
current_UL_BWP
=
mac
->
current_UL_BWP
;
NR_UE_ServingCell_Info_t
*
sc_info
=
&
mac
->
sc_info
;
NR_PUCCH_FormatConfig_t
*
pucchfmt
;
long
*
pusch_id
=
NULL
;
...
...
@@ -1556,7 +1555,7 @@ int16_t get_pucch_tx_power_ue(NR_UE_MAC_INST_t *mac,
int
subframe_number
,
int
O_uci
)
{
NR_UE_UL_BWP_t
*
current_UL_BWP
=
&
mac
->
current_UL_BWP
;
NR_UE_UL_BWP_t
*
current_UL_BWP
=
mac
->
current_UL_BWP
;
int
PUCCH_POWER_DEFAULT
=
0
;
int16_t
P_O_NOMINAL_PUCCH
=
*
current_UL_BWP
->
pucch_ConfigCommon
->
p0_nominal
;
...
...
@@ -1680,7 +1679,7 @@ int get_deltatf(uint16_t nb_of_prbs,
int
find_pucch_resource_set
(
NR_UE_MAC_INST_t
*
mac
,
int
size
)
{
int
pucch_resource_set_id
=
0
;
NR_PUCCH_Config_t
*
pucch_Config
=
mac
->
current_UL_BWP
.
pucch_Config
;
NR_PUCCH_Config_t
*
pucch_Config
=
mac
->
current_UL_BWP
->
pucch_Config
;
//long *pucch_max_pl_bits = NULL;
...
...
@@ -2140,7 +2139,7 @@ void merge_resources(PUCCH_sched_t *res, int num_res, NR_PUCCH_Config_t *pucch_C
void
multiplex_pucch_resource
(
NR_UE_MAC_INST_t
*
mac
,
PUCCH_sched_t
*
pucch
,
int
num_res
)
{
NR_PUCCH_Config_t
*
pucch_Config
=
mac
->
current_UL_BWP
.
pucch_Config
;
NR_PUCCH_Config_t
*
pucch_Config
=
mac
->
current_UL_BWP
->
pucch_Config
;
order_resources
(
pucch
,
num_res
);
// following pseudocode in Ref. 38.213 section 9.2.5 to multiplex resources
int
j
=
0
;
...
...
@@ -2225,8 +2224,8 @@ bool get_downlink_ack(NR_UE_MAC_INST_t *mac, frame_t frame, int slot, PUCCH_sche
int
number_harq_feedback
=
0
;
uint32_t
dai_max
=
0
;
NR_UE_DL_BWP_t
*
current_DL_BWP
=
&
mac
->
current_DL_BWP
;
NR_UE_UL_BWP_t
*
current_UL_BWP
=
&
mac
->
current_UL_BWP
;
NR_UE_DL_BWP_t
*
current_DL_BWP
=
mac
->
current_DL_BWP
;
NR_UE_UL_BWP_t
*
current_UL_BWP
=
mac
->
current_UL_BWP
;
bool
two_transport_blocks
=
false
;
int
number_of_code_word
=
1
;
...
...
@@ -2400,7 +2399,7 @@ bool get_downlink_ack(NR_UE_MAC_INST_t *mac, frame_t frame, int slot, PUCCH_sche
bool
trigger_periodic_scheduling_request
(
NR_UE_MAC_INST_t
*
mac
,
PUCCH_sched_t
*
pucch
,
frame_t
frame
,
int
slot
)
{
NR_UE_UL_BWP_t
*
current_UL_BWP
=
&
mac
->
current_UL_BWP
;
NR_UE_UL_BWP_t
*
current_UL_BWP
=
mac
->
current_UL_BWP
;
NR_PUCCH_Config_t
*
pucch_Config
=
current_UL_BWP
->
pucch_Config
;
const
int
n_slots_frame
=
nr_slots_per_frame
[
current_UL_BWP
->
scs
];
...
...
@@ -2502,7 +2501,7 @@ int compute_csi_priority(NR_UE_MAC_INST_t *mac, NR_CSI_ReportConfig_t *csirep)
int
nr_get_csi_measurements
(
NR_UE_MAC_INST_t
*
mac
,
frame_t
frame
,
int
slot
,
PUCCH_sched_t
*
pucch
)
{
NR_UE_UL_BWP_t
*
current_UL_BWP
=
&
mac
->
current_UL_BWP
;
NR_UE_UL_BWP_t
*
current_UL_BWP
=
mac
->
current_UL_BWP
;
NR_BWP_Id_t
bwp_id
=
current_UL_BWP
->
bwp_id
;
NR_PUCCH_Config_t
*
pucch_Config
=
current_UL_BWP
->
pucch_Config
;
int
num_csi
=
0
;
...
...
@@ -2877,8 +2876,8 @@ static uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
int
pos
=
0
;
int
fsize
=
0
;
int
rnti_type
=
get_rnti_type
(
mac
,
rnti
);
NR_UE_DL_BWP_t
*
current_DL_BWP
=
&
mac
->
current_DL_BWP
;
NR_UE_UL_BWP_t
*
current_UL_BWP
=
&
mac
->
current_UL_BWP
;
NR_UE_DL_BWP_t
*
current_DL_BWP
=
mac
->
current_DL_BWP
;
NR_UE_UL_BWP_t
*
current_UL_BWP
=
mac
->
current_UL_BWP
;
int
N_RB
;
if
(
current_DL_BWP
)
N_RB
=
get_rb_bwp_dci
(
dci_format
,
...
...
@@ -4166,8 +4165,14 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, int pdu_id)
#endif
// Schedule Msg3
NR_UE_UL_BWP_t
*
current_UL_BWP
=
&
mac
->
current_UL_BWP
;
NR_tda_info_t
tda_info
=
get_ul_tda_info
(
current_UL_BWP
,
*
mac
->
ra_SS
->
controlResourceSetId
,
mac
->
ra_SS
->
searchSpaceType
->
present
,
NR_RNTI_RA
,
rar_grant
.
Msg3_t_alloc
);
const
NR_UE_UL_BWP_t
*
current_UL_BWP
=
mac
->
current_UL_BWP
;
const
NR_UE_DL_BWP_t
*
current_DL_BWP
=
mac
->
current_DL_BWP
;
const
NR_BWP_PDCCH_t
*
pdcch_config
=
&
mac
->
config_BWP_PDCCH
[
current_DL_BWP
->
bwp_id
];
NR_tda_info_t
tda_info
=
get_ul_tda_info
(
current_UL_BWP
,
*
pdcch_config
->
ra_SS
->
controlResourceSetId
,
pdcch_config
->
ra_SS
->
searchSpaceType
->
present
,
NR_RNTI_RA
,
rar_grant
.
Msg3_t_alloc
);
if
(
tda_info
.
nrOfSymbols
==
0
)
{
LOG_E
(
MAC
,
"Cannot schedule Msg3. Something wrong in TDA information
\n
"
);
return
-
1
;
...
...
openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
View file @
78041a20
...
...
@@ -116,7 +116,7 @@ fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int sl
//Check if requested on the right slot
AssertFatal
(
is_nr_UL_slot
(
tdd_config
,
slot
,
mac
->
frame_type
)
!=
0
,
"UL config_request called at wrong slot %d
\n
"
,
slot
);
int
mu
=
mac
->
current_UL_BWP
.
scs
;
int
mu
=
mac
->
current_UL_BWP
->
scs
;
const
int
n
=
nr_slots_per_frame
[
mu
];
AssertFatal
(
fb_time
<
n
,
"Cannot schedule to a slot more than 1 frame away, ul_config_request is not big enough
\n
"
);
AssertFatal
(
mac
->
ul_config_request
!=
NULL
,
"mac->ul_config_request not initialized, logic bug
\n
"
);
...
...
@@ -135,7 +135,7 @@ fapi_nr_dl_config_request_t *get_dl_config_request(NR_UE_MAC_INST_t *mac, int sl
void
ul_layers_config
(
NR_UE_MAC_INST_t
*
mac
,
nfapi_nr_ue_pusch_pdu_t
*
pusch_config_pdu
,
dci_pdu_rel15_t
*
dci
,
nr_dci_format_t
dci_format
)
{
NR_UE_UL_BWP_t
*
current_UL_BWP
=
&
mac
->
current_UL_BWP
;
NR_UE_UL_BWP_t
*
current_UL_BWP
=
mac
->
current_UL_BWP
;
NR_SRS_Config_t
*
srs_config
=
current_UL_BWP
->
srs_Config
;
NR_PUSCH_Config_t
*
pusch_Config
=
current_UL_BWP
->
pusch_Config
;
...
...
@@ -240,7 +240,7 @@ void ul_ports_config(NR_UE_MAC_INST_t *mac, int *n_front_load_symb, nfapi_nr_ue_
{
uint8_t
rank
=
pusch_config_pdu
->
nrOfLayers
;
NR_PUSCH_Config_t
*
pusch_Config
=
mac
->
current_UL_BWP
.
pusch_Config
;
NR_PUSCH_Config_t
*
pusch_Config
=
mac
->
current_UL_BWP
->
pusch_Config
;
AssertFatal
(
pusch_Config
!=
NULL
,
"pusch_Config shouldn't be null
\n
"
);
long
transformPrecoder
=
pusch_config_pdu
->
transform_precoding
;
...
...
@@ -428,7 +428,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
int
N_PRB_oh
=
0
;
int
rnti_type
=
get_rnti_type
(
mac
,
rnti
);
NR_UE_UL_BWP_t
*
current_UL_BWP
=
&
mac
->
current_UL_BWP
;
NR_UE_UL_BWP_t
*
current_UL_BWP
=
mac
->
current_UL_BWP
;
NR_UE_ServingCell_Info_t
*
sc_info
=
&
mac
->
sc_info
;
// Common configuration
...
...
@@ -749,7 +749,7 @@ void configure_srs_pdu(NR_UE_MAC_INST_t *mac,
fapi_nr_ul_config_srs_pdu
*
srs_config_pdu
,
int
period
,
int
offset
)
{
NR_UE_UL_BWP_t
*
current_UL_BWP
=
&
mac
->
current_UL_BWP
;
NR_UE_UL_BWP_t
*
current_UL_BWP
=
mac
->
current_UL_BWP
;
srs_config_pdu
->
rnti
=
mac
->
crnti
;
srs_config_pdu
->
handle
=
0
;
...
...
@@ -820,7 +820,7 @@ void configure_srs_pdu(NR_UE_MAC_INST_t *mac,
// Aperiodic SRS scheduling
void
nr_ue_aperiodic_srs_scheduling
(
NR_UE_MAC_INST_t
*
mac
,
long
resource_trigger
,
int
frame
,
int
slot
)
{
NR_UE_UL_BWP_t
*
current_UL_BWP
=
&
mac
->
current_UL_BWP
;
NR_UE_UL_BWP_t
*
current_UL_BWP
=
mac
->
current_UL_BWP
;
NR_SRS_Config_t
*
srs_config
=
current_UL_BWP
->
srs_Config
;
if
(
!
srs_config
)
{
...
...
@@ -885,7 +885,7 @@ bool nr_ue_periodic_srs_scheduling(module_id_t mod_id, frame_t frame, slot_t slo
bool
srs_scheduled
=
false
;
NR_UE_MAC_INST_t
*
mac
=
get_mac_inst
(
mod_id
);
NR_UE_UL_BWP_t
*
current_UL_BWP
=
&
mac
->
current_UL_BWP
;
NR_UE_UL_BWP_t
*
current_UL_BWP
=
mac
->
current_UL_BWP
;
NR_SRS_Config_t
*
srs_config
=
current_UL_BWP
->
srs_Config
;
...
...
@@ -1437,7 +1437,7 @@ int nr_ue_pusch_scheduler(NR_UE_MAC_INST_t *mac, uint8_t is_Msg3, frame_t curren
DURATION_RX_TO_TX
);
int
delta
=
0
;
NR_UE_UL_BWP_t
*
current_UL_BWP
=
&
mac
->
current_UL_BWP
;
NR_UE_UL_BWP_t
*
current_UL_BWP
=
mac
->
current_UL_BWP
;
// Get the numerology to calculate the Tx frame and slot
int
mu
=
current_UL_BWP
->
scs
;
...
...
@@ -1521,7 +1521,7 @@ static void build_ro_list(NR_UE_MAC_INST_t *mac) {
uint8_t
nb_of_frames_per_prach_conf_period
;
uint8_t
prach_conf_period_frame_idx
;
NR_RACH_ConfigCommon_t
*
setup
=
mac
->
current_UL_BWP
.
rach_ConfigCommon
;
NR_RACH_ConfigCommon_t
*
setup
=
mac
->
current_UL_BWP
->
rach_ConfigCommon
;
NR_RACH_ConfigGeneric_t
*
rach_ConfigGeneric
=
&
setup
->
rach_ConfigGeneric
;
config_index
=
rach_ConfigGeneric
->
prach_ConfigurationIndex
;
...
...
@@ -1530,7 +1530,7 @@ static void build_ro_list(NR_UE_MAC_INST_t *mac) {
if
(
setup
->
msg1_SubcarrierSpacing
)
mu
=
*
setup
->
msg1_SubcarrierSpacing
;
else
mu
=
mac
->
current_UL_BWP
.
scs
;
mu
=
mac
->
current_UL_BWP
->
scs
;
msg1_FDM
=
rach_ConfigGeneric
->
msg1_FDM
;
...
...
@@ -1697,12 +1697,12 @@ static void build_ssb_list(NR_UE_MAC_INST_t *mac) {
}
// Map the transmitted SSBs to the ROs and create the association pattern according to the config
static
void
map_ssb_to_ro
(
NR_UE_MAC_INST_t
*
mac
)
{
static
void
map_ssb_to_ro
(
NR_UE_MAC_INST_t
*
mac
)
{
// Map SSBs to PRACH occasions
// ===========================
// WIP: Assumption: No PRACH occasion is rejected because of a conflict with SSBs or TDD_UL_DL_ConfigurationCommon schedule
NR_RACH_ConfigCommon_t
*
setup
=
mac
->
current_UL_BWP
.
rach_ConfigCommon
;
NR_RACH_ConfigCommon_t
*
setup
=
mac
->
current_UL_BWP
->
rach_ConfigCommon
;
NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR
ssb_perRACH_config
=
setup
->
ssb_perRACH_OccasionAndCB_PreamblesPerSSB
->
present
;
bool
multiple_ssb_per_ro
;
// true if more than one or exactly one SSB per RACH occasion, false if more than one RO per SSB
...
...
@@ -2002,7 +2002,7 @@ static int get_nr_prach_info_from_ssb_index(uint8_t ssb_idx,
// - exact slot number
// - frame offset
ssb_info_p
=
&
ssb_list
->
tx_ssb
[
ssb_idx
];
LOG_D
(
NR_MAC
,
"checking for prach : ssb_info_p->nb_mapped_ro %d
\n
"
,
ssb_info_p
->
nb_mapped_ro
);
LOG_D
(
NR_MAC
,
"checking for prach : ssb_info_p->nb_mapped_ro %d
\n
"
,
ssb_info_p
->
nb_mapped_ro
);
for
(
uint8_t
n_mapped_ro
=
0
;
n_mapped_ro
<
ssb_info_p
->
nb_mapped_ro
;
n_mapped_ro
++
)
{
LOG_D
(
NR_MAC
,
"%d.%d: mapped_ro[%d]->frame.slot %d.%d, prach_assoc_pattern.nb_of_frame %d
\n
"
,
frame
,
slot
,
n_mapped_ro
,
ssb_info_p
->
mapped_ro
[
n_mapped_ro
]
->
frame
,
ssb_info_p
->
mapped_ro
[
n_mapped_ro
]
->
slot
,
prach_assoc_pattern
.
nb_of_frame
);
...
...
@@ -2016,8 +2016,7 @@ static int get_nr_prach_info_from_ssb_index(uint8_t ssb_idx,
}
// If there is a matching RO slot in the SSB_to_RO map
if
(
NULL
!=
prach_occasion_slot_p
)
{
if
(
NULL
!=
prach_occasion_slot_p
)
{
// A random RO mapped to the SSB index should be selected in the slot
// First count the number of times the SSB index is found in that RO
...
...
@@ -2065,8 +2064,8 @@ static int get_nr_prach_info_from_ssb_index(uint8_t ssb_idx,
}
// Build the SSB to RO mapping upon RRC configuration update
void
build_ssb_to_ro_map
(
NR_UE_MAC_INST_t
*
mac
)
{
void
build_ssb_to_ro_map
(
NR_UE_MAC_INST_t
*
mac
)
{
// Clear all the lists and maps
memset
(
&
prach_assoc_pattern
,
0
,
sizeof
(
prach_association_pattern_t
));
memset
(
&
mac
->
ssb_list
,
0
,
sizeof
(
ssb_list_info_t
));
...
...
@@ -2171,7 +2170,7 @@ void nr_schedule_csi_for_im(NR_UE_MAC_INST_t *mac, int frame, int slot)
NR_CSI_IM_Resource_t
*
imcsi
;
int
period
,
offset
;
NR_UE_DL_BWP_t
*
current_DL_BWP
=
&
mac
->
current_DL_BWP
;
NR_UE_DL_BWP_t
*
current_DL_BWP
=
mac
->
current_DL_BWP
;
int
mu
=
current_DL_BWP
->
scs
;
uint16_t
bwp_size
=
current_DL_BWP
->
BWPSize
;
uint16_t
bwp_start
=
current_DL_BWP
->
BWPStart
;
...
...
@@ -2304,7 +2303,7 @@ void nr_schedule_csirs_reception(NR_UE_MAC_INST_t *mac, int frame, int slot)
return
;
fapi_nr_dl_config_request_t
*
dl_config
=
get_dl_config_request
(
mac
,
slot
);
NR_UE_DL_BWP_t
*
current_DL_BWP
=
&
mac
->
current_DL_BWP
;
NR_UE_DL_BWP_t
*
current_DL_BWP
=
mac
->
current_DL_BWP
;
NR_BWP_Id_t
dl_bwp_id
=
current_DL_BWP
->
bwp_id
;
int
mu
=
current_DL_BWP
->
scs
;
...
...
@@ -2466,7 +2465,7 @@ static void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_fr
fapi_nr_prach_config_t
*
prach_config
=
&
cfg
->
prach_config
;
nr_scheduled_response_t
scheduled_response
;
NR_RACH_ConfigCommon_t
*
setup
=
mac
->
current_UL_BWP
.
rach_ConfigCommon
;
NR_RACH_ConfigCommon_t
*
setup
=
mac
->
current_UL_BWP
->
rach_ConfigCommon
;
NR_RACH_ConfigGeneric_t
*
rach_ConfigGeneric
=
&
setup
->
rach_ConfigGeneric
;
NR_TDD_UL_DL_ConfigCommon_t
*
tdd_config
=
mac
->
tdd_UL_DL_ConfigurationCommon
;
...
...
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
View file @
78041a20
...
...
@@ -2018,6 +2018,43 @@ void reset_sched_ctrl(NR_UE_sched_ctrl_t *sched_ctrl)
sched_ctrl
->
srs_feedback
.
sri
=
0
;
}
int
get_dlbw_tbslbrm
(
int
scc_bwpsize
,
const
NR_ServingCellConfig_t
*
servingCellConfig
)
{
int
bw
=
scc_bwpsize
;
if
(
servingCellConfig
)
{
if
(
servingCellConfig
->
downlinkBWP_ToAddModList
)
{
const
struct
NR_ServingCellConfig__downlinkBWP_ToAddModList
*
BWP_list
=
servingCellConfig
->
downlinkBWP_ToAddModList
;
for
(
int
i
=
0
;
i
<
BWP_list
->
list
.
count
;
i
++
)
{
NR_BWP_t
genericParameters
=
BWP_list
->
list
.
array
[
i
]
->
bwp_Common
->
genericParameters
;
int
curr_bw
=
NRRIV2BW
(
genericParameters
.
locationAndBandwidth
,
MAX_BWP_SIZE
);
if
(
curr_bw
>
bw
)
bw
=
curr_bw
;
}
}
}
return
bw
;
}
int
get_ulbw_tbslbrm
(
int
scc_bwpsize
,
const
NR_ServingCellConfig_t
*
servingCellConfig
)
{
int
bw
=
scc_bwpsize
;
if
(
servingCellConfig
)
{
if
(
servingCellConfig
->
uplinkConfig
&&
servingCellConfig
->
uplinkConfig
->
uplinkBWP_ToAddModList
)
{
const
struct
NR_UplinkConfig__uplinkBWP_ToAddModList
*
BWP_list
=
servingCellConfig
->
uplinkConfig
->
uplinkBWP_ToAddModList
;
for
(
int
i
=
0
;
i
<
BWP_list
->
list
.
count
;
i
++
)
{
NR_BWP_t
genericParameters
=
BWP_list
->
list
.
array
[
i
]
->
bwp_Common
->
genericParameters
;
int
curr_bw
=
NRRIV2BW
(
genericParameters
.
locationAndBandwidth
,
MAX_BWP_SIZE
);
if
(
curr_bw
>
bw
)
bw
=
curr_bw
;
}
}
}
return
bw
;
}
// main function to configure parameters of current BWP
void
configure_UE_BWP
(
gNB_MAC_INST
*
nr_mac
,
NR_ServingCellConfigCommon_t
*
scc
,
...
...
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