Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lizhongxiao
OpenXG-RAN
Commits
48b07a2d
Commit
48b07a2d
authored
Dec 12, 2023
by
Chieh-Chun Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new coming UEs to the corresponding slice if slice exists
parent
6c1d04ee
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
76 additions
and
57 deletions
+76
-57
openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c
openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c
+14
-36
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
+4
-0
openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c
openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c
+5
-0
openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h
openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h
+2
-1
openair2/LAYER2/NR_MAC_gNB/slicing/nr_slicing.c
openair2/LAYER2/NR_MAC_gNB/slicing/nr_slicing.c
+48
-19
openair2/LAYER2/NR_MAC_gNB/slicing/nr_slicing.h
openair2/LAYER2/NR_MAC_gNB/slicing/nr_slicing.h
+2
-0
openair2/LAYER2/NR_MAC_gNB/slicing/nr_slicing_internal.h
openair2/LAYER2/NR_MAC_gNB/slicing/nr_slicing_internal.h
+1
-1
No files found.
openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c
View file @
48b07a2d
...
...
@@ -220,7 +220,13 @@ sm_ag_if_ans_t write_subs_rc_sm(void const* src)
}
static
int
add_mod_dl_slice
(
int
mod_id
,
slice_algorithm_e
current_algo
,
int
id
,
char
*
sst_str
,
int64_t
pct_reserved
)
static
int
add_mod_dl_slice
(
int
mod_id
,
slice_algorithm_e
current_algo
,
int
id
,
uint8_t
sst
,
uint32_t
sd
,
char
*
label
,
int64_t
pct_reserved
)
{
void
*
params
=
NULL
;
char
*
slice_algo
=
NULL
;
...
...
@@ -238,10 +244,11 @@ static int add_mod_dl_slice(int mod_id, slice_algorithm_e current_algo, int id,
nr_pp_impl_param_dl_t
*
dl
=
&
RC
.
nrmac
[
mod_id
]
->
pre_processor_dl
;
void
*
algo
=
&
dl
->
dl_algo
;
char
*
l
=
NULL
;
if
(
sst_str
)
l
=
strdup
(
sst_str
);
if
(
label
)
l
=
strdup
(
label
);
nssai_t
nssai
=
{.
sst
=
sst
,
.
sd
=
sd
};
LOG_W
(
NR_MAC
,
"add DL slice id %d, label %s, slice sched algo %s, pct_reserved %.2f, ue sched algo %s
\n
"
,
id
,
l
,
slice_algo
,
((
nvs_nr_slice_param_t
*
)
params
)
->
pct_reserved
,
dl
->
dl_algo
.
name
);
return
dl
->
addmod_slice
(
dl
->
slices
,
id
,
l
,
algo
,
params
);
return
dl
->
addmod_slice
(
dl
->
slices
,
id
,
nssai
,
l
,
algo
,
params
);
}
static
void
set_new_dl_slice_algo
(
int
mod_id
,
int
algo
)
...
...
@@ -275,19 +282,6 @@ static void set_new_dl_slice_algo(int mod_id, int algo)
// return -1;
//}
static
int
assoc_ue_to_dl_slice
(
int
mod_id
,
NR_UE_info_t
*
assoc_ue
,
uint32_t
assoc_dl_id
)
{
nr_pp_impl_param_dl_t
*
dl
=
&
RC
.
nrmac
[
mod_id
]
->
pre_processor_dl
;
int
new_idx
=
find_dl_slice
(
dl
->
slices
,
assoc_dl_id
);
int
old_idx
=
find_dl_slice
(
dl
->
slices
,
assoc_ue
->
dl_id
);
if
(
new_idx
<
0
||
old_idx
<
0
)
return
-
100
;
LOG_W
(
NR_MAC
,
"associate UE RNTI 0x%04x from slice ID %d idx %d to slice ID %d idx %d
\n
"
,
assoc_ue
->
rnti
,
assoc_ue
->
dl_id
,
old_idx
,
assoc_dl_id
,
new_idx
);
dl
->
move_UE
(
dl
->
slices
,
assoc_ue
,
old_idx
,
new_idx
);
return
0
;
}
static
char
*
copy_bytearr_to_str
(
const
byte_array_t
*
ba
)
{
if
(
ba
->
len
<
1
)
...
...
@@ -429,7 +423,7 @@ static bool add_mod_rc_slice(int mod_id, size_t slices_len, ran_param_list_t* ls
//LOG_I(NR_MAC, "configure slice %ld, label %s, Max_PRB_Policy_Ratio %ld\n", i, label_nssai, max_prb_ratio);
///// ADD SLICE /////
const
int
rc
=
add_mod_dl_slice
(
mod_id
,
current_algo
,
i
,
label_nssai
,
(
float
)
nvs_cap
);
const
int
rc
=
add_mod_dl_slice
(
mod_id
,
current_algo
,
i
+
1
,
RC_sst
,
RC_sd
,
label_nssai
,
(
float
)
nvs_cap
);
free
(
label_nssai
);
if
(
rc
<
0
)
{
pthread_mutex_unlock
(
&
nrmac
->
UE_info
.
mutex
);
...
...
@@ -444,6 +438,7 @@ static bool add_mod_rc_slice(int mod_id, size_t slices_len, ran_param_list_t* ls
if
(
nrmac
->
UE_info
.
list
[
0
]
==
NULL
)
LOG_E
(
NR_MAC
,
"no UE connected
\n
"
);
nr_pp_impl_param_dl_t
*
dl
=
&
RC
.
nrmac
[
mod_id
]
->
pre_processor_dl
;
NR_UEs_t
*
UE_info
=
&
RC
.
nrmac
[
mod_id
]
->
UE_info
;
UE_iterator
(
UE_info
->
list
,
UE
)
{
...
...
@@ -474,24 +469,7 @@ static bool add_mod_rc_slice(int mod_id, size_t slices_len, ran_param_list_t* ls
UE_mcc
,
UE_mnc
,
UE_sst
,
UE_sd
,
RC_mcc
,
RC_mnc
,
RC_sst
,
RC_sd
);
if
(
UE_mcc
==
RC_mcc
&&
UE_mnc
==
RC_mnc
&&
UE_sst
==
RC_sst
&&
UE_sd
==
RC_sd
)
{
/* Check current slice of this RNTI before assoc */
size_t
cur_idx
=
dl
->
get_UE_slice_idx
(
dl
->
slices
,
rnti
);
if
(
i
==
cur_idx
)
{
LOG_D
(
NR_MAC
,
"expected DL slice association for UE RNTI 0x%04x
\n
"
,
rnti
);
continue
;
}
/* Check this RNTI in the current slice before assoc */
int
cur_ue_idx
=
dl
->
get_UE_idx
(
dl
->
slices
->
s
[
cur_idx
],
rnti
);
if
(
cur_ue_idx
<
0
)
{
LOG_E
(
NR_MAC
,
"error while associating RNTI 0x%04x
\n
"
,
rnti
);
continue
;
}
/* Associate this RNTI to another dl slice */
int
rc
=
assoc_ue_to_dl_slice
(
mod_id
,
nrmac
->
UE_info
.
list
[
cur_ue_idx
],
i
);
if
(
rc
<
0
)
{
LOG_E
(
NR_MAC
,
"error code %d while associating RNTI 0x%04x
\n
"
,
rc
,
rnti
);
continue
;
}
dl
->
add_UE
(
dl
->
slices
,
UE
);
}
else
{
LOG_W
(
NR_MAC
,
"cannot find specified PLMN (mcc %d mnc %d) NSSAI (sst %d sd %d) from the existing UE PLMN (mcc %d mnc %d) NSSAI (sst %d sd %d)
\n
"
,
RC_mcc
,
RC_mnc
,
RC_sst
,
RC_sd
,
UE_mcc
,
UE_mnc
,
UE_sst
,
UE_sd
);
...
...
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
View file @
48b07a2d
...
...
@@ -2430,6 +2430,10 @@ NR_UE_info_t *add_new_nr_ue(gNB_MAC_INST *nr_mac, rnti_t rntiP, NR_CellGroupConf
reset_srs_stats
(
UE
);
// associate UEs to the first slice if slice exists (there is no DRB setup in this stage)
nr_pp_impl_param_dl_t
*
dl
=
&
RC
.
nrmac
[
0
]
->
pre_processor_dl
;
if
(
dl
->
slices
)
dl
->
add_UE
(
dl
->
slices
,
UE
);
NR_SCHED_LOCK
(
&
UE_info
->
mutex
);
int
i
;
for
(
i
=
0
;
i
<
MAX_MOBILES_PER_GNB
;
i
++
)
{
...
...
openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c
View file @
48b07a2d
...
...
@@ -462,6 +462,11 @@ void ue_context_modification_request(const f1ap_ue_context_modif_req_t *req)
/* Set NSSAI config in MAC for each active DRB */
set_nssaiConfig
(
req
->
drbs_to_be_setup_length
,
req
->
drbs_to_be_setup
,
&
UE
->
UE_sched_ctrl
);
/* Associate UE to the corresponding slice*/
nr_pp_impl_param_dl_t
*
dl
=
&
mac
->
pre_processor_dl
;
if
(
dl
->
slices
)
dl
->
add_UE
(
dl
->
slices
,
UE
);
}
else
{
ASN_STRUCT_FREE
(
asn_DEF_NR_CellGroupConfig
,
new_CellGroup
);
// we actually don't need it
}
...
...
openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h
View file @
48b07a2d
...
...
@@ -758,7 +758,7 @@ typedef struct {
int
algorithm
;
/// inform the slice algorithm about a new UE
void
(
*
add_UE
)(
struct
nr_slice_info_s
*
s
,
NR_UE_info_t
*
*
UE_list
);
void
(
*
add_UE
)(
struct
nr_slice_info_s
*
s
,
NR_UE_info_t
*
new_ue
);
/// inform the slice algorithm about a UE that disconnected
void
(
*
remove_UE
)(
struct
nr_slice_info_s
*
s
,
NR_UE_info_t
*
rm_ue
,
int
idx
);
/// move a UE to a slice in DL/UL, -1 means don't move (no-op).
...
...
@@ -775,6 +775,7 @@ typedef struct {
/// slice. Returns index of new slice or -1 on failure.
int
(
*
addmod_slice
)(
struct
nr_slice_info_s
*
s
,
int
id
,
nssai_t
nssai
,
char
*
label
,
void
*
sched
,
void
*
slice_params
);
...
...
openair2/LAYER2/NR_MAC_gNB/slicing/nr_slicing.c
View file @
48b07a2d
...
...
@@ -78,28 +78,50 @@ int nr_slicing_get_UE_idx(nr_slice_t *si, rnti_t rnti)
return
-
99
;
}
void
nr_slicing_add_UE
(
nr_slice_info_t
*
si
,
NR_UE_info_t
**
UE_list
)
static
bool
nssai_matches
(
nssai_t
a_nssai
,
uint8_t
b_sst
,
const
uint32_t
*
b_sd
)
{
// Add all the connected UEs to the first slice 0
UE_iterator
(
UE_list
,
UE
)
{
UE
->
dl_id
=
0
;
if
(
si
->
num
>
0
&&
si
->
s
!=
NULL
)
{
for
(
int
i
=
0
;
i
<
MAX_MOBILES_PER_GNB
;
i
++
)
{
if
(
si
->
s
[
0
]
->
UE_list
[
i
]
==
NULL
)
{
si
->
s
[
0
]
->
UE_list
[
i
]
=
UE
;
si
->
s
[
0
]
->
num_UEs
+=
1
;
LOG_D
(
NR_MAC
,
"%s(), add UE_list[%d], rnti 0x%04x to slice idx 0
\n
"
,
__func__
,
i
,
si
->
s
[
0
]
->
UE_list
[
i
]
->
rnti
);
break
;
}
AssertFatal
(
b_sd
==
NULL
||
*
b_sd
<=
0xffffff
,
"illegal SD %d
\n
"
,
*
b_sd
);
if
(
b_sd
==
NULL
)
{
return
a_nssai
.
sst
==
b_sst
&&
a_nssai
.
sd
==
0xffffff
;
}
else
{
return
a_nssai
.
sst
==
b_sst
&&
a_nssai
.
sd
==
*
b_sd
;
}
}
void
nr_slicing_add_UE
(
nr_slice_info_t
*
si
,
NR_UE_info_t
*
new_ue
)
{
AssertFatal
(
si
->
num
>
0
&&
si
->
s
!=
NULL
,
"no slices exists, cannot add UEs
\n
"
);
NR_UE_sched_ctrl_t
*
sched_ctrl
=
&
new_ue
->
UE_sched_ctrl
;
bool
matched_ue
=
0
;
long
lcid
=
0
;
int
slice_idx
=
0
;
for
(
int
i
=
0
;
i
<
si
->
num
;
++
i
)
{
for
(
int
l
=
0
;
l
<
sched_ctrl
->
dl_lc_num
;
++
l
)
{
lcid
=
sched_ctrl
->
dl_lc_ids
[
l
];
LOG_D
(
NR_MAC
,
"l %d, lcid %ld, sst %d, sd %d
\n
"
,
l
,
lcid
,
sched_ctrl
->
dl_lc_nssai
[
lcid
].
sst
,
sched_ctrl
->
dl_lc_nssai
[
lcid
].
sd
);
if
(
nssai_matches
(
sched_ctrl
->
dl_lc_nssai
[
lcid
],
si
->
s
[
i
]
->
nssai
.
sst
,
&
si
->
s
[
i
]
->
nssai
.
sd
))
{
matched_ue
=
1
;
// assume UE only associates to one slice
break
;
}
}
if
(
matched_ue
)
{
slice_idx
=
i
;
break
;
}
else
{
LOG_
E
(
NR_MAC
,
"no slice exists, cannot add UEs to first slice
\n
"
);
LOG_
W
(
NR_MAC
,
"cannot find lcid for UE rnti 0x%04x, associate UE at the first slice
\n
"
,
new_ue
->
rnti
);
}
}
new_ue
->
dl_id
=
si
->
s
[
slice_idx
]
->
id
;
int
num_UEs
=
si
->
s
[
slice_idx
]
->
num_UEs
;
if
(
si
->
s
[
slice_idx
]
->
UE_list
[
num_UEs
]
==
NULL
)
{
si
->
s
[
slice_idx
]
->
UE_list
[
num_UEs
]
=
new_ue
;
si
->
s
[
slice_idx
]
->
num_UEs
+=
1
;
}
else
{
LOG_E
(
NR_MAC
,
"cannot add new UE rnti 0x%04x to slice idx %d, num_UEs %d
\n
"
,
new_ue
->
rnti
,
slice_idx
,
si
->
s
[
slice_idx
]
->
num_UEs
);
}
LOG_W
(
NR_MAC
,
"Add UE rnti 0x%04x to slice idx %d, sst %d, sd %d
\n
"
,
new_ue
->
rnti
,
slice_idx
,
si
->
s
[
slice_idx
]
->
nssai
.
sst
,
si
->
s
[
slice_idx
]
->
nssai
.
sd
);
}
void
nr_slicing_remove_UE
(
nr_slice_info_t
*
si
,
NR_UE_info_t
*
rm_ue
,
int
idx
)
...
...
@@ -235,6 +257,7 @@ int _nvs_nr_admission_control(const nr_slice_info_t *si,
int
addmod_nvs_nr_slice_dl
(
nr_slice_info_t
*
si
,
int
id
,
nssai_t
nssai
,
char
*
label
,
void
*
algo
,
void
*
slice_params_dl
)
...
...
@@ -272,6 +295,7 @@ int addmod_nvs_nr_slice_dl(nr_slice_info_t *si,
}
else
{
/* we have no parameters: we are done */
return
index
;
}
s
->
nssai
=
nssai
;
}
else
{
if
(
!
algo
)
RET_FAIL
(
-
14
,
"%s(): no scheduler algorithm provided
\n
"
,
__func__
);
...
...
@@ -289,6 +313,7 @@ int addmod_nvs_nr_slice_dl(nr_slice_info_t *si,
if
(
!
s
->
dl_algo
.
data
)
s
->
dl_algo
.
data
=
s
->
dl_algo
.
setup
();
s
->
algo_data
=
dl
;
s
->
nssai
=
nssai
;
}
_nvs_int_t
*
nvs_p
=
s
->
int_data
;
...
...
@@ -494,10 +519,14 @@ nr_pp_impl_param_dl_t nvs_nr_dl_init(module_id_t mod_id)
dlp
->
pct_reserved
=
1
.
0
f
;
nr_dl_sched_algo_t
*
algo
=
&
RC
.
nrmac
[
mod_id
]
->
pre_processor_dl
.
dl_algo
;
algo
->
data
=
NULL
;
const
int
rc
=
addmod_nvs_nr_slice_dl
(
si
,
0
,
strdup
(
"default"
),
algo
,
dlp
);
nssai_t
nssai
=
{.
sst
=
1
,
.
sd
=
0
};
const
int
rc
=
addmod_nvs_nr_slice_dl
(
si
,
0
,
nssai
,
strdup
(
"default"
),
algo
,
dlp
);
DevAssert
(
0
==
rc
);
NR_UEs_t
*
UE_info
=
&
RC
.
nrmac
[
mod_id
]
->
UE_info
;
nr_slicing_add_UE
(
si
,
UE_info
->
list
);
UE_iterator
(
UE_info
->
list
,
UE
)
{
nr_slicing_add_UE
(
si
,
UE
);
}
nr_pp_impl_param_dl_t
nvs
;
nvs
.
algorithm
=
NVS_SLICING
;
...
...
openair2/LAYER2/NR_MAC_gNB/slicing/nr_slicing.h
View file @
48b07a2d
...
...
@@ -48,6 +48,8 @@ typedef struct nr_slice_s {
// list of users in this slice
int
num_UEs
;
NR_UE_info_t
*
UE_list
[
MAX_MOBILES_PER_GNB
+
1
];
nssai_t
nssai
;
}
nr_slice_t
;
typedef
struct
nr_slice_info_s
{
...
...
openair2/LAYER2/NR_MAC_gNB/slicing/nr_slicing_internal.h
View file @
48b07a2d
...
...
@@ -32,7 +32,7 @@
#include "nr_slicing.h"
void
nr_slicing_add_UE
(
nr_slice_info_t
*
si
,
NR_UE_info_t
*
*
UE_list
);
void
nr_slicing_add_UE
(
nr_slice_info_t
*
si
,
NR_UE_info_t
*
new_ue
);
void
nr_slicing_remove_UE
(
nr_slice_info_t
*
si
,
NR_UE_info_t
*
rm_ue
,
int
idx
);
...
...
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