Skip to content

Commit fe3ef2e

Browse files
committed
sched: draft design of scheduler slicing
1 parent a0c67b4 commit fe3ef2e

File tree

14 files changed

+527
-1
lines changed

14 files changed

+527
-1
lines changed

include/srsran/ran/rrm.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,16 @@
1414

1515
namespace srsran {
1616

17-
/// O-RAN.WG3.E2SM-RC-R003-v3.00 Section 8.4.3.6
17+
/// Identifier of a RRM Policy Member.
18+
/// \remark See O-RAN.WG3.E2SM-RC-R003-v3.00 Section 8.4.3.6
1819
struct rrm_policy_member {
1920
std::string plmn_id;
2021
s_nssai_t s_nssai;
22+
23+
bool operator==(const rrm_policy_member& other) const
24+
{
25+
return plmn_id == other.plmn_id and s_nssai == other.s_nssai;
26+
}
2127
};
2228

2329
struct rrm_policy_ratio_group {

include/srsran/ran/s_nssai.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ struct s_nssai_t {
2020
uint8_t sst = 0;
2121
/// Slice Differentiator (max 24bits).
2222
std::optional<uint32_t> sd;
23+
24+
bool operator==(const s_nssai_t& other) const { return sst == other.sst && sd == other.sd; }
2325
};
2426

2527
} // namespace srsran
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
*
3+
* Copyright 2021-2024 Software Radio Systems Limited
4+
*
5+
* By using this file, you agree to the terms and conditions set
6+
* forth in the LICENSE file which can be found at the top level of
7+
* the distribution.
8+
*
9+
*/
10+
11+
#pragma once
12+
13+
#include "srsran/ran/rrm.h"
14+
#include "srsran/ran/s_nssai.h"
15+
16+
namespace srsran {
17+
18+
/// Cell-specific Default RAN slice configuration.
19+
struct cell_rrm_policy_config {
20+
/// RRM Policy identifier.
21+
rrm_policy_member rrc_member;
22+
/// Sets the minimum percentage of PRBs to be allocated to this group.
23+
unsigned min_prb_ratio = 0;
24+
/// Sets the maximum percentage of PRBs to be allocated to this group.
25+
unsigned max_prb_ratio = MAX_NOF_PRBS;
26+
};
27+
28+
} // namespace srsran

include/srsran/scheduler/config/logical_channel_config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "srsran/adt/optional.h"
1414
#include "srsran/ran/lcid.h"
15+
#include "srsran/ran/rrm.h"
1516
#include "srsran/ran/sr_configuration.h"
1617
#include "srsran/scheduler/config/logical_channel_group.h"
1718

@@ -26,6 +27,7 @@ struct logical_channel_config {
2627
std::optional<scheduling_request_id> sr_id;
2728
bool lc_sr_mask;
2829
bool lc_sr_delay_timer_applied;
30+
rrm_policy_member rrm_policy;
2931
};
3032

3133
} // namespace srsran

include/srsran/scheduler/scheduler_configurator.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "srsran/ran/subcarrier_spacing.h"
3232
#include "srsran/ran/tdd/tdd_ul_dl_config.h"
3333
#include "srsran/scheduler/config/bwp_configuration.h"
34+
#include "srsran/scheduler/config/cell_rrm_policy_config.h"
3435
#include "srsran/scheduler/config/dmrs.h"
3536
#include "srsran/scheduler/config/logical_channel_config.h"
3637
#include "srsran/scheduler/config/serving_cell_config.h"
@@ -91,6 +92,9 @@ struct sched_cell_configuration_request_message {
9192
/// List of nzp-CSI-RS resources common to all UEs.
9293
std::vector<nzp_csi_rs_resource> nzp_csi_rs_res_list;
9394

95+
/// List of RAN slices to support in the scheduler.
96+
std::vector<cell_rrm_policy_config> rrm_policy_members;
97+
9498
unsigned ntn_cs_koffset = 0;
9599
};
96100

lib/scheduler/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ set(SOURCES
3737
support/dci_builder.cpp
3838
support/sch_pdu_builder.cpp
3939
support/csi_report_helpers.cpp
40+
slicing/slice_scheduler.cpp
41+
slicing/ran_slice_instance.cpp
4042
cell_scheduler.cpp
4143
scheduler_factory.cpp
4244
scheduler_impl.cpp

lib/scheduler/config/cell_configuration.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ cell_configuration::cell_configuration(const scheduler_expert_config&
3636
pucch_guardbands(msg.pucch_guardbands),
3737
zp_csi_rs_list(msg.zp_csi_rs_list),
3838
nzp_csi_rs_list(msg.nzp_csi_rs_res_list),
39+
rrm_policy_members(msg.rrm_policy_members),
3940
// SSB derived params.
4041
ssb_case(band_helper::get_ssb_pattern(msg.dl_carrier.band, msg.ssb_config.scs)),
4142
paired_spectrum(band_helper::is_paired_spectrum(msg.dl_carrier.band)),

lib/scheduler/config/cell_configuration.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ class cell_configuration
5555
/// List of nzp-CSI-RS resources.
5656
std::vector<nzp_csi_rs_resource> nzp_csi_rs_list;
5757

58+
/// List of RRM Policy members configured for this cell.
59+
std::vector<cell_rrm_policy_config> rrm_policy_members;
60+
5861
// Derived Parameters.
5962
ssb_pattern_case ssb_case;
6063
bool paired_spectrum;
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/*
2+
*
3+
* Copyright 2021-2024 Software Radio Systems Limited
4+
*
5+
* By using this file, you agree to the terms and conditions set
6+
* forth in the LICENSE file which can be found at the top level of
7+
* the distribution.
8+
*
9+
*/
10+
11+
#pragma once
12+
13+
#include "ran_slice_instance.h"
14+
15+
namespace srsran {
16+
namespace detail {
17+
18+
template <bool IsDl>
19+
class common_ran_slice_candidate
20+
{
21+
struct candidate_deleter {
22+
void operator()(ran_slice_instance* p)
23+
{
24+
if (p != nullptr) {
25+
if constexpr (IsDl) {
26+
p->pdsch_completed();
27+
} else {
28+
p->pusch_completed();
29+
}
30+
}
31+
}
32+
};
33+
34+
public:
35+
common_ran_slice_candidate(ran_slice_instance* instance_) : inst(instance_, candidate_deleter{}) {}
36+
37+
ran_slice_id_t id() const { return inst->id; }
38+
[[nodiscard]] const cell_rrm_policy_config& cfg() const { return inst->cfg; }
39+
scheduler_policy& policy() { return *inst->policy; }
40+
41+
bool is_candidate(du_ue_index_t ue_idx) const { return inst->is_candidate(ue_idx); }
42+
bool is_candidate(du_ue_index_t ue_idx, lcid_t lcid) const { return inst->is_candidate(ue_idx, lcid); }
43+
44+
/// Signal that the allocations for this slice are complete.
45+
void clear() { inst.reset(); }
46+
47+
/// Register that a new grant was allocated for a given UE.
48+
void store_grant(unsigned nof_rbs)
49+
{
50+
if constexpr (IsDl) {
51+
inst->store_pdsch_grant(nof_rbs);
52+
} else {
53+
inst->store_pusch_grant(nof_rbs);
54+
}
55+
}
56+
57+
/// Remaining bytes to allocate for the given slice.
58+
[[nodiscard]] unsigned remaining_rbs() const
59+
{
60+
if constexpr (IsDl) {
61+
return inst->cfg.max_prb_ratio < inst->pdsch_rb_count ? 0 : inst->cfg.max_prb_ratio - inst->pdsch_rb_count;
62+
}
63+
return inst->cfg.max_prb_ratio < inst->pusch_rb_count ? 0 : inst->cfg.max_prb_ratio - inst->pusch_rb_count;
64+
}
65+
66+
protected:
67+
std::unique_ptr<ran_slice_instance, candidate_deleter> inst;
68+
};
69+
70+
} // namespace detail
71+
72+
/// \brief Handle to fetch and update the state of a RAN slice in a given DL slot.
73+
///
74+
/// On destruction, the slice is marked as completed for the current slot and won't be considered as a candidate again.
75+
using dl_ran_slice_candidate = detail::common_ran_slice_candidate<true>;
76+
77+
/// Interface to fetch and update the state of a RAN slice in a given UL slot.
78+
///
79+
/// On destruction, the slice is marked as completed for the current slot and won't be considered as a candidate again.
80+
using ul_ran_slice_candidate = detail::common_ran_slice_candidate<false>;
81+
82+
} // namespace srsran
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
*
3+
* Copyright 2021-2024 Software Radio Systems Limited
4+
*
5+
* By using this file, you agree to the terms and conditions set
6+
* forth in the LICENSE file which can be found at the top level of
7+
* the distribution.
8+
*
9+
*/
10+
11+
#pragma once
12+
13+
#include "srsran/adt/strong_type.h"
14+
#include <cstdint>
15+
16+
namespace srsran {
17+
18+
/// RAN slice identifier that should be unique for a given cell,PLMN,S-NSSAI.
19+
struct ran_slice_id_tag {};
20+
using ran_slice_id_t = strong_type<uint8_t, struct ran_slice_id_tag, strong_increment_decrement>;
21+
22+
} // namespace srsran

0 commit comments

Comments
 (0)