Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-RAN
Commits
e30552c2
Commit
e30552c2
authored
May 24, 2024
by
Robert Schmidt
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/refactor-lcid-gnb-mac' into integration_2024_w21c
parents
5686b2a2
98df398d
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
220 additions
and
205 deletions
+220
-205
CMakeLists.txt
CMakeLists.txt
+1
-0
common/utils/alg/find.c
common/utils/alg/find.c
+1
-1
common/utils/alg/find.h
common/utils/alg/find.h
+1
-1
common/utils/ds/tests/test_seq_array.c
common/utils/ds/tests/test_seq_array.c
+1
-1
openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_kpm.c
openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_kpm.c
+8
-8
openair2/LAYER2/NR_MAC_gNB/config.c
openair2/LAYER2/NR_MAC_gNB/config.c
+17
-75
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c
+6
-4
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c
+3
-3
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
+89
-3
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
+1
-1
openair2/LAYER2/NR_MAC_gNB/mac_proto.h
openair2/LAYER2/NR_MAC_gNB/mac_proto.h
+8
-1
openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c
openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c
+64
-93
openair2/LAYER2/NR_MAC_gNB/main.c
openair2/LAYER2/NR_MAC_gNB/main.c
+5
-5
openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h
openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h
+15
-9
No files found.
CMakeLists.txt
View file @
e30552c2
...
...
@@ -1457,6 +1457,7 @@ add_library(L2_NR
${
MAC_NR_SRC
}
${
GNB_APP_SRC
}
)
target_link_libraries
(
L2_NR PRIVATE ds alg
)
add_library
(
e1_if
${
NR_RRC_DIR
}
/cucp_cuup_direct.c
...
...
common/utils/alg/find.c
View file @
e30552c2
...
...
@@ -40,7 +40,7 @@ elm_arr_t find_if_arr_it(seq_arr_t* arr, void* start_it, void* end_it, void* val
return
(
elm_arr_t
){.
found
=
false
,
.
it
=
NULL
};
}
elm_arr_t
find_if
_arr
(
seq_arr_t
*
arr
,
void
*
value
,
bool
(
*
f
)(
const
void
*
,
const
void
*
))
elm_arr_t
find_if
(
seq_arr_t
*
arr
,
void
*
value
,
bool
(
*
f
)(
const
void
*
,
const
void
*
))
{
assert
(
arr
!=
NULL
);
void
*
start_it
=
seq_arr_front
(
arr
);
...
...
common/utils/alg/find.h
View file @
e30552c2
...
...
@@ -42,7 +42,7 @@ typedef struct {
* @param f Function representing the predicate
* @return Whether the predicate was fullfilled and the iterator to the element if true
*/
elm_arr_t
find_if
_arr
(
seq_arr_t
*
arr
,
void
*
value
,
bool
(
*
f
)(
const
void
*
value
,
const
void
*
it
));
elm_arr_t
find_if
(
seq_arr_t
*
arr
,
void
*
value
,
bool
(
*
f
)(
const
void
*
value
,
const
void
*
it
));
/**
* @brief Find elements in an array in the semi-open range [start_it, end_it)
...
...
common/utils/ds/tests/test_seq_array.c
View file @
e30552c2
...
...
@@ -52,7 +52,7 @@ int main()
// Find element in the array
int
value
=
50
;
elm_arr_t
elm
=
find_if
_arr
(
&
arr
,
&
value
,
eq_int
);
elm_arr_t
elm
=
find_if
(
&
arr
,
&
value
,
eq_int
);
assert
(
elm
.
found
==
true
);
// Check
assert
(
*
(
int
*
)
elm
.
it
==
50
);
...
...
openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_kpm.c
View file @
e30552c2
...
...
@@ -53,7 +53,7 @@ typedef struct {
// Optional
// only used to retreive MAC/RLC stats
NR_UE_info_t
*
ue_info_list
;
NR_UE_info_t
*
*
ue_info_list
;
}
arr_ue_id_t
;
static
meas_data_lst_t
fill_kpm_meas_data_item
(
const
meas_info_format_1_lst_t
*
meas_info_lst
,
const
size_t
len
,
const
uint32_t
gran_period_ms
,
cudu_ue_info_pair_t
ue_info
,
const
size_t
ue_idx
)
...
...
@@ -114,14 +114,14 @@ static cudu_ue_info_pair_t fill_ue_related_info(arr_ue_id_t* arr_ue_id, const si
if
(
arr_ue_id
->
ue_id
[
ue_idx
].
type
==
GNB_UE_ID_E2SM
)
{
ue_info
.
rrc_ue_id
=
*
arr_ue_id
->
ue_id
[
ue_idx
].
gnb
.
ran_ue_id
;
// rrc_ue_id
ue_info
.
ue
=
&
arr_ue_id
->
ue_info_list
[
ue_idx
];
ue_info
.
ue
=
arr_ue_id
->
ue_info_list
[
ue_idx
];
}
else
if
(
arr_ue_id
->
ue_id
[
ue_idx
].
type
==
GNB_CU_UP_UE_ID_E2SM
)
{
/* in OAI implementation, CU-UP ue id = CU-CP ue id
=> CU-UP ue id = rrc_ue_id, but it should not be the case by the spec */
ue_info
.
rrc_ue_id
=
*
arr_ue_id
->
ue_id
[
ue_idx
].
gnb_cu_up
.
ran_ue_id
;
// cucp_ue_id = rrc_ue_id
}
else
if
(
arr_ue_id
->
ue_id
[
ue_idx
].
type
==
GNB_DU_UE_ID_E2SM
)
{
ue_info
.
rrc_ue_id
=
*
arr_ue_id
->
ue_id
[
ue_idx
].
gnb_du
.
ran_ue_id
;
// rrc_ue_id
ue_info
.
ue
=
&
arr_ue_id
->
ue_info_list
[
ue_idx
];
ue_info
.
ue
=
arr_ue_id
->
ue_info_list
[
ue_idx
];
}
return
ue_info
;
...
...
@@ -275,7 +275,7 @@ static arr_ue_id_t filter_ues_by_s_nssai_in_du_or_monolithic(const test_info_lst
arr_ue_id
.
ue_id
=
calloc
(
MAX_MOBILES_PER_GNB
,
sizeof
(
ue_id_e2sm_t
));
assert
(
arr_ue_id
.
ue_id
!=
NULL
);
arr_ue_id
.
ue_info_list
=
calloc
(
MAX_MOBILES_PER_GNB
,
sizeof
(
NR_UE_info_
t
));
arr_ue_id
.
ue_info_list
=
calloc
(
MAX_MOBILES_PER_GNB
,
sizeof
(
*
arr_ue_id
.
ue_info_lis
t
));
assert
(
arr_ue_id
.
ue_info_list
!=
NULL
);
const
ngran_node_t
node_type
=
get_e2_node_type
();
...
...
@@ -284,9 +284,9 @@ static arr_ue_id_t filter_ues_by_s_nssai_in_du_or_monolithic(const test_info_lst
UE_iterator
(
RC
.
nrmac
[
0
]
->
UE_info
.
list
,
ue
)
{
NR_UE_sched_ctrl_t
*
sched_ctrl
=
&
ue
->
UE_sched_ctrl
;
// UE matches if any of its DRBs matches
for
(
int
l
=
0
;
l
<
sched_ctrl
->
dl_lc_num
;
++
l
)
{
long
lcid
=
sched_ctrl
->
dl_lc_ids
[
l
]
;
if
(
nssai_matches
(
sched_ctrl
->
dl_lc_nssai
[
lcid
]
,
sst
,
sd
))
{
for
(
size_t
l
=
0
;
l
<
seq_arr_size
(
&
sched_ctrl
->
lc_config
)
;
++
l
)
{
const
nr_lc_config_t
*
c
=
seq_arr_at
(
&
sched_ctrl
->
lc_config
,
l
)
;
if
(
nssai_matches
(
c
->
nssai
,
sst
,
sd
))
{
if
(
node_type
==
ngran_gNB_DU
)
{
f1_ue_data_t
rrc_ue_id
=
du_get_f1_ue_data
(
ue
->
rnti
);
// gNB CU UE ID = rrc_ue_id
arr_ue_id
.
ue_id
[
arr_ue_id
.
sz
]
=
fill_ue_id_data
[
ngran_gNB_DU
](
NULL
,
rrc_ue_id
.
secondary_ue
,
0
);
...
...
@@ -296,7 +296,7 @@ static arr_ue_id_t filter_ues_by_s_nssai_in_du_or_monolithic(const test_info_lst
}
// store NR_UE_info_t
arr_ue_id
.
ue_info_list
[
arr_ue_id
.
sz
]
=
*
ue
;
arr_ue_id
.
ue_info_list
[
arr_ue_id
.
sz
]
=
ue
;
arr_ue_id
.
sz
++
;
break
;
...
...
openair2/LAYER2/NR_MAC_gNB/config.c
View file @
e30552c2
...
...
@@ -266,73 +266,6 @@ nfapi_nr_pm_list_t init_DL_MIMO_codebook(gNB_MAC_INST *gNB, nr_pdsch_AntennaPort
return
mat
;
}
static
void
process_rlcBearerConfig
(
struct
NR_CellGroupConfig__rlc_BearerToAddModList
*
rlc_bearer2add_list
,
struct
NR_CellGroupConfig__rlc_BearerToReleaseList
*
rlc_bearer2release_list
,
NR_UE_sched_ctrl_t
*
sched_ctrl
)
{
if
(
rlc_bearer2release_list
)
{
for
(
int
i
=
0
;
i
<
rlc_bearer2release_list
->
list
.
count
;
i
++
)
{
for
(
int
idx
=
0
;
idx
<
sched_ctrl
->
dl_lc_num
;
idx
++
)
{
if
(
sched_ctrl
->
dl_lc_ids
[
idx
]
==
*
rlc_bearer2release_list
->
list
.
array
[
i
])
{
const
int
remaining_lcs
=
sched_ctrl
->
dl_lc_num
-
idx
-
1
;
memmove
(
&
sched_ctrl
->
dl_lc_ids
[
idx
],
&
sched_ctrl
->
dl_lc_ids
[
idx
+
1
],
sizeof
(
sched_ctrl
->
dl_lc_ids
[
idx
])
*
remaining_lcs
);
sched_ctrl
->
dl_lc_num
--
;
break
;
}
}
}
}
if
(
rlc_bearer2add_list
)
{
// keep lcids
for
(
int
i
=
0
;
i
<
rlc_bearer2add_list
->
list
.
count
;
i
++
)
{
const
int
lcid
=
rlc_bearer2add_list
->
list
.
array
[
i
]
->
logicalChannelIdentity
;
bool
found
=
false
;
for
(
int
idx
=
0
;
idx
<
sched_ctrl
->
dl_lc_num
;
idx
++
)
{
if
(
sched_ctrl
->
dl_lc_ids
[
idx
]
==
lcid
)
{
found
=
true
;
break
;
}
}
if
(
!
found
)
{
sched_ctrl
->
dl_lc_num
++
;
sched_ctrl
->
dl_lc_ids
[
sched_ctrl
->
dl_lc_num
-
1
]
=
lcid
;
LOG_D
(
NR_MAC
,
"Adding LCID %d (%s %d)
\n
"
,
lcid
,
lcid
<
4
?
"SRB"
:
"DRB"
,
lcid
);
}
}
}
LOG_D
(
NR_MAC
,
"In %s: total num of active bearers %d)
\n
"
,
__FUNCTION__
,
sched_ctrl
->
dl_lc_num
);
}
void
process_CellGroup
(
NR_CellGroupConfig_t
*
CellGroup
,
NR_UE_info_t
*
UE
)
{
/* we assume that this function is mutex-protected from outside */
NR_SCHED_ENSURE_LOCKED
(
&
RC
.
nrmac
[
0
]
->
sched_lock
);
AssertFatal
(
CellGroup
,
"CellGroup is null
\n
"
);
NR_MAC_CellGroupConfig_t
*
mac_CellGroupConfig
=
CellGroup
->
mac_CellGroupConfig
;
if
(
mac_CellGroupConfig
)
{
//process_drx_Config(sched_ctrl,mac_CellGroupConfig->drx_Config);
//process_schedulingRequestConfig(sched_ctrl,mac_CellGroupConfig->schedulingRequestConfig);
//process_bsrConfig(sched_ctrl,mac_CellGroupConfig->bsr_Config);
//process_tag_Config(sched_ctrl,mac_CellGroupConfig->tag_Config);
//process_phr_Config(sched_ctrl,mac_CellGroupConfig->phr_Config);
}
if
(
CellGroup
->
spCellConfig
&&
CellGroup
->
spCellConfig
->
reconfigurationWithSync
&&
CellGroup
->
spCellConfig
->
reconfigurationWithSync
->
rach_ConfigDedicated
&&
CellGroup
->
spCellConfig
->
reconfigurationWithSync
->
rach_ConfigDedicated
->
choice
.
uplink
->
cfra
)
{
nr_mac_prepare_ra_ue
(
RC
.
nrmac
[
0
],
UE
->
rnti
,
CellGroup
);
}
process_rlcBearerConfig
(
CellGroup
->
rlc_BearerToAddModList
,
CellGroup
->
rlc_BearerToReleaseList
,
&
UE
->
UE_sched_ctrl
);
}
static
void
config_common
(
gNB_MAC_INST
*
nrmac
,
nr_pdsch_AntennaPorts_t
pdsch_AntennaPorts
,
int
pusch_AntennaPorts
,
NR_ServingCellConfigCommon_t
*
scc
)
{
nfapi_nr_config_request_scf_t
*
cfg
=
&
nrmac
->
config
[
0
];
...
...
@@ -752,20 +685,30 @@ void nr_mac_configure_sib1(gNB_MAC_INST *nrmac, const f1ap_plmn_t *plmn, uint64_
bool
nr_mac_add_test_ue
(
gNB_MAC_INST
*
nrmac
,
uint32_t
rnti
,
NR_CellGroupConfig_t
*
CellGroup
)
{
/* ideally, instead of this function, "users" of this function should call
* the ue context setup request function in mac_rrc_dl_handler.c */
DevAssert
(
nrmac
!=
NULL
);
DevAssert
(
CellGroup
!=
NULL
);
DevAssert
(
get_softmodem_params
()
->
phy_test
);
NR_SCHED_LOCK
(
&
nrmac
->
sched_lock
);
NR_UE_info_t
*
UE
=
add_new_nr_ue
(
nrmac
,
rnti
,
CellGroup
);
if
(
UE
)
{
LOG_I
(
NR_MAC
,
"Force-added new UE %x with initial CellGroup
\n
"
,
rnti
);
process_CellGroup
(
CellGroup
,
UE
);
}
else
{
LOG_E
(
NR_MAC
,
"Error adding UE %04x
\n
"
,
rnti
);
NR_UE_info_t
*
UE
=
add_new_nr_ue
(
nrmac
,
rnti
,
CellGroup
);
if
(
!
UE
)
{
LOG_E
(
NR_MAC
,
"Error adding UE %04x
\n
"
,
rnti
);
NR_SCHED_UNLOCK
(
&
nrmac
->
sched_lock
);
return
false
;
}
if
(
CellGroup
->
spCellConfig
&&
CellGroup
->
spCellConfig
->
reconfigurationWithSync
&&
CellGroup
->
spCellConfig
->
reconfigurationWithSync
->
rach_ConfigDedicated
&&
CellGroup
->
spCellConfig
->
reconfigurationWithSync
->
rach_ConfigDedicated
->
choice
.
uplink
->
cfra
)
{
nr_mac_prepare_ra_ue
(
RC
.
nrmac
[
0
],
UE
->
rnti
,
CellGroup
);
}
process_addmod_bearers_cellGroupConfig
(
&
UE
->
UE_sched_ctrl
,
CellGroup
->
rlc_BearerToAddModList
);
AssertFatal
(
CellGroup
->
rlc_BearerToReleaseList
==
NULL
,
"cannot release bearers while adding new UEs
\n
"
);
NR_SCHED_UNLOCK
(
&
nrmac
->
sched_lock
);
return
UE
!=
NULL
;
LOG_I
(
NR_MAC
,
"Added new UE %x with initial CellGroup
\n
"
,
rnti
);
return
true
;
}
bool
nr_mac_prepare_ra_ue
(
gNB_MAC_INST
*
nrmac
,
uint32_t
rnti
,
NR_CellGroupConfig_t
*
CellGroup
)
...
...
@@ -823,7 +766,6 @@ bool nr_mac_prepare_cellgroup_update(gNB_MAC_INST *nrmac, NR_UE_info_t *UE, NR_C
/* we assume that this function is mutex-protected from outside */
NR_SCHED_ENSURE_LOCKED
(
&
nrmac
->
sched_lock
);
process_CellGroup
(
CellGroup
,
UE
);
UE
->
reconfigCellGroup
=
CellGroup
;
UE
->
expect_reconfiguration
=
true
;
...
...
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c
View file @
e30552c2
...
...
@@ -329,8 +329,9 @@ static void nr_store_dlsch_buffer(module_id_t module_id, frame_t frame, sub_fram
/* loop over all activated logical channels */
// Note: DL_SCH_LCID_DCCH, DL_SCH_LCID_DCCH1, DL_SCH_LCID_DTCH
for
(
int
i
=
0
;
i
<
sched_ctrl
->
dl_lc_num
;
++
i
)
{
const
int
lcid
=
sched_ctrl
->
dl_lc_ids
[
i
];
for
(
int
i
=
0
;
i
<
seq_arr_size
(
&
sched_ctrl
->
lc_config
);
++
i
)
{
const
nr_lc_config_t
*
c
=
seq_arr_at
(
&
sched_ctrl
->
lc_config
,
i
);
const
int
lcid
=
c
->
lcid
;
const
uint16_t
rnti
=
UE
->
rnti
;
LOG_D
(
NR_MAC
,
"In %s: UE %x: LCID %d
\n
"
,
__FUNCTION__
,
rnti
,
lcid
);
if
(
lcid
==
DL_SCH_LCID_DTCH
&&
sched_ctrl
->
rrc_processing_timer
>
0
)
{
...
...
@@ -1275,8 +1276,9 @@ void nr_schedule_ue_spec(module_id_t module_id,
if
(
sched_ctrl
->
num_total_bytes
>
0
)
{
/* loop over all activated logical channels */
for
(
int
i
=
0
;
i
<
sched_ctrl
->
dl_lc_num
;
++
i
)
{
const
int
lcid
=
sched_ctrl
->
dl_lc_ids
[
i
];
for
(
int
i
=
0
;
i
<
seq_arr_size
(
&
sched_ctrl
->
lc_config
);
++
i
)
{
const
nr_lc_config_t
*
c
=
seq_arr_at
(
&
sched_ctrl
->
lc_config
,
i
);
const
int
lcid
=
c
->
lcid
;
if
(
sched_ctrl
->
rlc_status
[
lcid
].
bytes_in_buffer
==
0
)
continue
;
// no data for this LC tbs_size_t len = 0;
...
...
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c
View file @
e30552c2
...
...
@@ -104,9 +104,9 @@ void nr_preprocessor_phytest(module_id_t module_id,
}
sched_ctrl
->
num_total_bytes
=
0
;
sched_ctrl
->
dl_lc_num
=
1
;
const
int
lcid
=
DL_SCH_LCID_DTCH
;
sched_ctrl
->
dl_lc_ids
[
sched_ctrl
->
dl_lc_num
-
1
]
=
lcid
;
DevAssert
(
seq_arr_size
(
&
sched_ctrl
->
lc_config
)
==
1
)
;
const
nr_lc_config_t
*
c
=
seq_arr_at
(
&
sched_ctrl
->
lc_config
,
0
)
;
const
int
lcid
=
c
->
lcid
;
const
uint16_t
rnti
=
UE
->
rnti
;
/* update sched_ctrl->num_total_bytes so that postprocessor schedules data,
* if available */
...
...
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
View file @
e30552c2
...
...
@@ -59,6 +59,8 @@
#include "common/ran_context.h"
#include "nfapi/oai_integration/vendor_ext.h"
#include "common/utils/alg/find.h"
//#define DEBUG_DCI
extern
RAN_CONTEXT_t
RC
;
...
...
@@ -2097,6 +2099,7 @@ void delete_nr_ue_data(NR_UE_info_t *UE, NR_COMMON_channels_t *ccPtr, uid_alloca
ASN_STRUCT_FREE
(
asn_DEF_NR_CellGroupConfig
,
UE
->
reconfigCellGroup
);
ASN_STRUCT_FREE
(
asn_DEF_NR_UE_NR_Capability
,
UE
->
capability
);
NR_UE_sched_ctrl_t
*
sched_ctrl
=
&
UE
->
UE_sched_ctrl
;
seq_arr_free
(
&
sched_ctrl
->
lc_config
,
NULL
);
destroy_nr_list
(
&
sched_ctrl
->
available_dl_harq
);
destroy_nr_list
(
&
sched_ctrl
->
feedback_dl_harq
);
destroy_nr_list
(
&
sched_ctrl
->
retrans_dl_harq
);
...
...
@@ -2490,6 +2493,9 @@ NR_UE_info_t *add_new_nr_ue(gNB_MAC_INST *nr_mac, rnti_t rntiP, NR_CellGroupConf
sched_ctrl
->
sched_srs
.
frame
=
-
1
;
sched_ctrl
->
sched_srs
.
slot
=
-
1
;
// initialize LCID structure
seq_arr_init
(
&
sched_ctrl
->
lc_config
,
sizeof
(
nr_lc_config_t
));
// initialize UE BWP information
NR_UE_DL_BWP_t
*
dl_bwp
=
&
UE
->
current_DL_BWP
;
memset
(
dl_bwp
,
0
,
sizeof
(
*
dl_bwp
));
...
...
@@ -2964,7 +2970,6 @@ static void nr_mac_apply_cellgroup(gNB_MAC_INST *mac, NR_UE_info_t *UE, frame_t
NR_ServingCellConfigCommon_t
*
scc
=
mac
->
common_channels
[
0
].
ServingCellConfigCommon
;
/* Note! we already did process_CellGroup(), so no need to do this again */
NR_UE_sched_ctrl_t
*
sched_ctrl
=
&
UE
->
UE_sched_ctrl
;
configure_UE_BWP
(
mac
,
scc
,
sched_ctrl
,
NULL
,
UE
,
-
1
,
-
1
);
...
...
@@ -3123,12 +3128,12 @@ void prepare_initial_ul_rrc_message(gNB_MAC_INST *mac, NR_UE_info_t *UE)
NR_SCHED_ENSURE_LOCKED
(
&
mac
->
sched_lock
);
/* create this UE's initial CellGroup */
int
CC_id
=
0
;
int
srb_id
=
1
;
const
NR_ServingCellConfigCommon_t
*
scc
=
mac
->
common_channels
[
CC_id
].
ServingCellConfigCommon
;
const
NR_ServingCellConfig_t
*
sccd
=
mac
->
common_channels
[
CC_id
].
pre_ServingCellConfig
;
NR_CellGroupConfig_t
*
cellGroupConfig
=
get_initial_cellGroupConfig
(
UE
->
uid
,
scc
,
sccd
,
&
mac
->
radio_config
);
UE
->
CellGroup
=
cellGroupConfig
;
process_CellGroup
(
cellGroupConfig
,
UE
);
/* activate SRB0 */
nr_rlc_activate_srb0
(
UE
->
rnti
,
UE
,
send_initial_ul_rrc_message
);
...
...
@@ -3136,8 +3141,12 @@ void prepare_initial_ul_rrc_message(gNB_MAC_INST *mac, NR_UE_info_t *UE)
/* the cellGroup sent to CU specifies there is SRB1, so create it */
DevAssert
(
cellGroupConfig
->
rlc_BearerToAddModList
->
list
.
count
==
1
);
const
NR_RLC_BearerConfig_t
*
bearer
=
cellGroupConfig
->
rlc_BearerToAddModList
->
list
.
array
[
0
];
DevAssert
(
bearer
->
servedRadioBearer
->
choice
.
srb_Identity
==
1
);
DevAssert
(
bearer
->
servedRadioBearer
->
choice
.
srb_Identity
==
srb_id
);
nr_rlc_add_srb
(
UE
->
rnti
,
bearer
->
servedRadioBearer
->
choice
.
srb_Identity
,
bearer
);
int
priority
=
bearer
->
mac_LogicalChannelConfig
->
ul_SpecificParameters
->
priority
;
nr_lc_config_t
c
=
{.
lcid
=
bearer
->
logicalChannelIdentity
,
.
priority
=
priority
};
nr_mac_add_lcid
(
&
UE
->
UE_sched_ctrl
,
&
c
);
}
void
nr_mac_trigger_release_timer
(
NR_UE_sched_ctrl_t
*
sched_ctrl
,
NR_SubcarrierSpacing_t
subcarrier_spacing
)
...
...
@@ -3213,3 +3222,80 @@ void nr_mac_trigger_reconfiguration(const gNB_MAC_INST *nrmac, const NR_UE_info_
};
nrmac
->
mac_rrc
.
ue_context_modification_required
(
&
required
);
}
/* \brief add bearers from CellGroupConfig.
*
* This is a kind of hack, as this should be processed through a F1 UE Context
* setup request, but some modes do not use that (NSA/do-ra/phy_test). */
void
process_addmod_bearers_cellGroupConfig
(
NR_UE_sched_ctrl_t
*
sched_ctrl
,
const
struct
NR_CellGroupConfig__rlc_BearerToAddModList
*
addmod
)
{
if
(
addmod
==
NULL
)
return
;
/* nothing to do */
for
(
int
i
=
0
;
i
<
addmod
->
list
.
count
;
++
i
)
{
const
NR_RLC_BearerConfig_t
*
conf
=
addmod
->
list
.
array
[
i
];
int
lcid
=
conf
->
logicalChannelIdentity
;
nr_lc_config_t
c
=
{.
lcid
=
lcid
};
nr_mac_add_lcid
(
sched_ctrl
,
&
c
);
}
}
long
get_lcid_from_drbid
(
int
drb_id
)
{
return
drb_id
+
3
;
/* LCID is DRB + 3 */
}
long
get_lcid_from_srbid
(
int
srb_id
)
{
return
srb_id
;
}
static
bool
eq_lcid_config
(
const
void
*
vval
,
const
void
*
vit
)
{
const
nr_lc_config_t
*
val
=
(
const
nr_lc_config_t
*
)
vval
;
const
nr_lc_config_t
*
it
=
(
const
nr_lc_config_t
*
)
vit
;
return
it
->
lcid
==
val
->
lcid
;
}
static
int
cmp_lc_config
(
const
void
*
va
,
const
void
*
vb
)
{
const
nr_lc_config_t
*
a
=
(
const
nr_lc_config_t
*
)
va
;
const
nr_lc_config_t
*
b
=
(
const
nr_lc_config_t
*
)
vb
;
if
(
a
->
priority
<
b
->
priority
)
return
-
1
;
if
(
a
->
priority
==
b
->
priority
)
return
0
;
return
1
;
}
bool
nr_mac_add_lcid
(
NR_UE_sched_ctrl_t
*
sched_ctrl
,
const
nr_lc_config_t
*
c
)
{
elm_arr_t
elm
=
find_if
(
&
sched_ctrl
->
lc_config
,
(
void
*
)
c
,
eq_lcid_config
);
if
(
elm
.
found
)
{
LOG_I
(
NR_MAC
,
"cannot add LCID %d: already present, updating configuration
\n
"
,
c
->
lcid
);
nr_lc_config_t
*
exist
=
(
nr_lc_config_t
*
)
elm
.
it
;
*
exist
=
*
c
;
}
else
{
LOG_D
(
NR_MAC
,
"Add LCID %d
\n
"
,
c
->
lcid
);
seq_arr_push_back
(
&
sched_ctrl
->
lc_config
,
(
void
*
)
c
,
sizeof
(
*
c
));
}
void
*
base
=
seq_arr_front
(
&
sched_ctrl
->
lc_config
);
size_t
nmemb
=
seq_arr_size
(
&
sched_ctrl
->
lc_config
);
size_t
size
=
sizeof
(
*
c
);
qsort
(
base
,
nmemb
,
size
,
cmp_lc_config
);
return
true
;
}
bool
nr_mac_remove_lcid
(
NR_UE_sched_ctrl_t
*
sched_ctrl
,
long
lcid
)
{
nr_lc_config_t
c
=
{.
lcid
=
lcid
};
elm_arr_t
elm
=
find_if
(
&
sched_ctrl
->
lc_config
,
&
c
,
eq_lcid_config
);
if
(
!
elm
.
found
)
{
LOG_E
(
NR_MAC
,
"can not remove LC: no such LC with ID %ld
\n
"
,
lcid
);
return
false
;
}
seq_arr_erase
(
&
sched_ctrl
->
lc_config
,
elm
.
it
);
return
true
;
}
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
View file @
e30552c2
...
...
@@ -811,7 +811,7 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP,
reset_dl_harq_list
(
UE_scheduling_control
);
reset_ul_harq_list
(
UE_scheduling_control
);
nr_clear_ra_proc
(
ra
);
process_
CellGroup
(
ra
->
CellGroup
,
UE
);
process_
addmod_bearers_cellGroupConfig
(
&
UE
->
UE_sched_ctrl
,
ra
->
CellGroup
->
rlc_BearerToAddModList
);
}
else
{
LOG_A
(
NR_MAC
,
"[RAPROC] RA-Msg3 received (sdu_lenP %d)
\n
"
,
sdu_lenP
);
LOG_D
(
NR_MAC
,
"[RAPROC] Received Msg3:
\n
"
);
...
...
openair2/LAYER2/NR_MAC_gNB/mac_proto.h
View file @
e30552c2
...
...
@@ -424,7 +424,8 @@ void nr_sr_reporting(gNB_MAC_INST *nrmac, frame_t frameP, sub_frame_t slotP);
size_t
dump_mac_stats
(
gNB_MAC_INST
*
gNB
,
char
*
output
,
size_t
strlen
,
bool
reset_rsrp
);
void
process_CellGroup
(
NR_CellGroupConfig_t
*
CellGroup
,
NR_UE_info_t
*
UE
);
long
get_lcid_from_drbid
(
int
drb_id
);
long
get_lcid_from_srbid
(
int
srb_id
);
void
prepare_initial_ul_rrc_message
(
gNB_MAC_INST
*
mac
,
NR_UE_info_t
*
UE
);
void
send_initial_ul_rrc_message
(
int
rnti
,
const
uint8_t
*
sdu
,
sdu_size_t
sdu_len
,
void
*
data
);
...
...
@@ -441,4 +442,10 @@ void nr_mac_check_ul_failure(const gNB_MAC_INST *nrmac, int rnti, NR_UE_sched_ct
void
nr_mac_trigger_reconfiguration
(
const
gNB_MAC_INST
*
nrmac
,
const
NR_UE_info_t
*
UE
);
void
process_addmod_bearers_cellGroupConfig
(
NR_UE_sched_ctrl_t
*
sched_ctrl
,
const
struct
NR_CellGroupConfig__rlc_BearerToAddModList
*
addmod
);
bool
nr_mac_add_lcid
(
NR_UE_sched_ctrl_t
*
sched_ctrl
,
const
nr_lc_config_t
*
c
);
bool
nr_mac_remove_lcid
(
NR_UE_sched_ctrl_t
*
sched_ctrl
,
long
lcid
);
#endif
/*__LAYER2_NR_MAC_PROTO_H__*/
openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c
View file @
e30552c2
This diff is collapsed.
Click to expand it.
openair2/LAYER2/NR_MAC_gNB/main.c
View file @
e30552c2
...
...
@@ -179,15 +179,15 @@ size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, size_t strlen, bool reset
"UE %04x: MAC: TX %14"
PRIu64
" RX %14"
PRIu64
" bytes
\n
"
,
UE
->
rnti
,
stats
->
dl
.
total_bytes
,
stats
->
ul
.
total_bytes
);
for
(
int
i
=
0
;
i
<
s
ched_ctrl
->
dl_lc_num
;
i
++
)
{
int
lc_id
=
sched_ctrl
->
dl_lc_ids
[
i
]
;
for
(
int
i
=
0
;
i
<
s
eq_arr_size
(
&
sched_ctrl
->
lc_config
)
;
i
++
)
{
const
nr_lc_config_t
*
c
=
seq_arr_at
(
&
sched_ctrl
->
lc_config
,
i
)
;
output
+=
snprintf
(
output
,
end
-
output
,
"UE %04x: LCID %d: TX %14"
PRIu64
" RX %14"
PRIu64
" bytes
\n
"
,
UE
->
rnti
,
lc_
id
,
stats
->
dl
.
lc_bytes
[
lc_
id
],
stats
->
ul
.
lc_bytes
[
lc_
id
]);
c
->
lc
id
,
stats
->
dl
.
lc_bytes
[
c
->
lc
id
],
stats
->
ul
.
lc_bytes
[
c
->
lc
id
]);
}
}
NR_SCHED_UNLOCK
(
&
gNB
->
UE_info
.
mutex
);
...
...
openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h
View file @
e30552c2
...
...
@@ -42,6 +42,7 @@
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include "common/utils/ds/seq_arr.h"
#define NR_SCHED_LOCK(lock) \
do { \
...
...
@@ -518,10 +519,20 @@ typedef struct NR_UE_ul_harq {
}
NR_UE_ul_harq_t
;
typedef
struct
NR_QoS_config_s
{
uint64_
t
fiveQI
;
uint64_
t
priority
;
in
t
fiveQI
;
in
t
priority
;
}
NR_QoS_config_t
;
typedef
struct
nr_lc_config
{
uint8_t
lcid
;
/// priority as specified in 38.321
int
priority
;
/// associated NSSAI for DRB
nssai_t
nssai
;
/// QoS config for DRB
NR_QoS_config_t
qos_config
[
NR_MAX_NUM_QFI
];
}
nr_lc_config_t
;
/*! \brief scheduling control information set through an API */
#define MAX_CSI_REPORTS 48
typedef
struct
{
...
...
@@ -613,20 +624,15 @@ typedef struct {
/// UL HARQ processes that await retransmission
NR_list_t
retrans_ul_harq
;
NR_UE_mac_ce_ctrl_t
UE_mac_ce_ctrl
;
// MAC CE related information
/// number of active DL LCs
uint8_t
dl_lc_num
;
/// order in which DLSCH scheduler should allocate LCs
uint8_t
dl_lc_ids
[
NR_MAX_NUM_LCID
];
/// Timer for RRC processing procedures
uint32_t
rrc_processing_timer
;
/// sri, ul_ri and tpmi based on SRS
nr_srs_feedback_t
srs_feedback
;
nssai_t
dl_lc_nssai
[
NR_MAX_NUM_LCID
];
//
Information about the QoS configuration for each LCID/DRB
NR_QoS_config_t
qos_config
[
NR_MAX_NUM_LCID
-
4
][
NR_MAX_NUM_QFI
];
// 0 -CCCH and 1- 3 SRBs(0,1,2)
//
/ per-LC configuration
seq_arr_t
lc_config
;
}
NR_UE_sched_ctrl_t
;
typedef
struct
{
...
...
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