Skip to content

Commit 9bc62a3

Browse files
committed
sched: improve of documentation of slice scheduler and fix minor bugs
1 parent 862d963 commit 9bc62a3

File tree

7 files changed

+25
-20
lines changed

7 files changed

+25
-20
lines changed

include/srsran/scheduler/config/slice_rrm_policy_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ struct slice_rrm_policy_config {
2525
unsigned max_prb = MAX_NOF_PRBS;
2626
};
2727

28-
} // namespace srsran
28+
} // namespace srsran

lib/scheduler/slicing/ran_slice_candidate.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
namespace srsran {
1616
namespace detail {
1717

18+
/// \brief RAN slice that is the next candidate for allocation in a given slot and cell.
1819
template <bool IsDl>
1920
class common_ran_slice_candidate
2021
{
@@ -38,8 +39,8 @@ class common_ran_slice_candidate
3839
[[nodiscard]] const slice_rrm_policy_config& cfg() const { return inst->cfg; }
3940
scheduler_policy& policy() { return *inst->policy; }
4041

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); }
42+
bool is_candidate(du_ue_index_t ue_idx) const { return inst->contains(ue_idx); }
43+
bool is_candidate(du_ue_index_t ue_idx, lcid_t lcid) const { return inst->contains(ue_idx, lcid); }
4344

4445
/// Signal that the allocations for this slice are complete.
4546
void clear() { inst.reset(); }

lib/scheduler/slicing/ran_slice_id.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ namespace srsran {
1919
struct ran_slice_id_tag {};
2020
using ran_slice_id_t = strong_type<uint8_t, struct ran_slice_id_tag, strong_increment_decrement>;
2121

22-
} // namespace srsran
22+
} // namespace srsran

lib/scheduler/slicing/ran_slice_instance.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ void ran_slice_instance::slot_indication()
2727
pusch_stopped = false;
2828
}
2929

30-
void ran_slice_instance::set_logical_channel(du_ue_index_t ue_idx, lcid_t lcid)
30+
void ran_slice_instance::add_logical_channel(du_ue_index_t ue_idx, lcid_t lcid)
3131
{
3232
if (not bearers.contains(ue_idx)) {
3333
bearers.emplace(ue_idx, MAX_NOF_RB_LCIDS);

lib/scheduler/slicing/ran_slice_instance.h

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ namespace srsran {
2121
class ran_slice_instance
2222
{
2323
public:
24-
constexpr static int skip_slice_prio = std::numeric_limits<int>::min();
24+
constexpr static int skip_slice_prio = std::numeric_limits<int>::min();
25+
constexpr static int default_slice_prio = 0;
2526

2627
ran_slice_instance(ran_slice_id_t id_, const cell_configuration& cell_cfg_, const slice_rrm_policy_config& cfg_);
2728

@@ -34,15 +35,15 @@ class ran_slice_instance
3435
if (not active() or pdsch_stopped or cfg.max_prb <= pdsch_rb_count) {
3536
return skip_slice_prio;
3637
}
37-
return cfg.min_prb > pdsch_rb_count ? cfg.min_prb - pdsch_rb_count : 0;
38+
return cfg.min_prb > pdsch_rb_count ? cfg.min_prb - pdsch_rb_count : default_slice_prio;
3839
}
3940

4041
int get_ul_prio()
4142
{
4243
if (not active() or pusch_stopped or cfg.max_prb <= pusch_rb_count) {
4344
return skip_slice_prio;
4445
}
45-
return cfg.min_prb > pusch_rb_count ? cfg.min_prb - pusch_rb_count : 0;
46+
return cfg.min_prb > pusch_rb_count ? cfg.min_prb - pusch_rb_count : default_slice_prio;
4647
}
4748

4849
/// Save PDSCH grant.
@@ -57,17 +58,19 @@ class ran_slice_instance
5758
/// Mark the allocation of PUSCH for this slice and the current slot as complete.
5859
void pusch_completed() { pusch_stopped = true; }
5960

60-
/// Determine if a UE is a candidate for this slice.
61-
bool is_candidate(du_ue_index_t ue_idx) const { return bearers.contains(ue_idx); }
61+
/// Determine if at least one bearer of the given UE is currently managed by this slice.
62+
bool contains(du_ue_index_t ue_idx) const { return bearers.contains(ue_idx); }
6263

63-
/// Determine if a (UE, LCID) is a candidate for this slice.
64-
bool is_candidate(du_ue_index_t ue_idx, lcid_t lcid) const
65-
{
66-
return is_candidate(ue_idx) and bearers[ue_idx].test(lcid);
67-
}
64+
/// Determine if a (UE, LCID) tuple are managed by this slice.
65+
bool contains(du_ue_index_t ue_idx, lcid_t lcid) const { return contains(ue_idx) and bearers[ue_idx].test(lcid); }
6866

69-
void set_logical_channel(du_ue_index_t ue_idx, lcid_t lcid);
67+
/// Add a new (UE, LCID) to the list of bearers managed by this slice.
68+
void add_logical_channel(du_ue_index_t ue_idx, lcid_t lcid);
69+
70+
/// Remove a (UE, LCID) from the list of bearers managed by this slice.
7071
void rem_logical_channel(du_ue_index_t ue_idx, lcid_t lcid);
72+
73+
/// Remove a UE and all associated LCIDs from the list of bearers managed by this slice.
7174
void rem_ue(du_ue_index_t ue_idx);
7275

7376
ran_slice_id_t id;
@@ -88,4 +91,4 @@ class ran_slice_instance
8891
bool pusch_stopped = false;
8992
};
9093

91-
} // namespace srsran
94+
} // namespace srsran

lib/scheduler/slicing/slice_scheduler.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ slice_scheduler::slice_scheduler(const cell_configuration& cell_cfg_, const slic
3030
create_scheduler_strategy(scheduler_strategy_params{"time_rr", &logger}, cell_cfg.expert_cfg.ue);
3131
sorted_dl_prios.emplace_back(id_count);
3232
sorted_ul_prios.emplace_back(id_count);
33+
++id_count;
3334
// Configured RRM policy members
3435
for (const slice_rrm_policy_config& rrm : cell_cfg.rrm_policy_members) {
3536
slices.emplace_back(id_count, cell_cfg, rrm);
@@ -64,7 +65,7 @@ void slice_scheduler::add_ue(du_ue_index_t ue_idx, const ue_configuration& ue_cf
6465
{
6566
for (const logical_channel_config& lc_cfg : ue_cfg.logical_channels()) {
6667
ran_slice_instance& sl_inst = get_slice(lc_cfg.rrm_policy);
67-
sl_inst.set_logical_channel(ue_idx, lc_cfg.lcid);
68+
sl_inst.add_logical_channel(ue_idx, lc_cfg.lcid);
6869
}
6970
}
7071

@@ -81,7 +82,7 @@ void slice_scheduler::reconf_ue(du_ue_index_t ue_idx,
8182
// Add new bearers.
8283
for (const logical_channel_config& lc_cfg : next_ue_cfg.logical_channels()) {
8384
ran_slice_instance& sl_inst = get_slice(lc_cfg.rrm_policy);
84-
sl_inst.set_logical_channel(ue_idx, lc_cfg.lcid);
85+
sl_inst.add_logical_channel(ue_idx, lc_cfg.lcid);
8586
}
8687
}
8788

lib/scheduler/slicing/slice_scheduler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,4 @@ class slice_scheduler
6464
std::vector<slice_prio_context> sorted_ul_prios;
6565
};
6666

67-
} // namespace srsran
67+
} // namespace srsran

0 commit comments

Comments
 (0)