Skip to content

Commit 3cb0925

Browse files
herlesupreethcodebot
authored andcommitted
sched: fix condition to re-add the slice candidate to queue
1 parent 1c032a3 commit 3cb0925

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

lib/scheduler/slicing/slice_scheduler.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@ slice_scheduler::get_next_candidate()
234234
}
235235

236236
const slice_rrm_policy_config& cfg = chosen_slice.inst.cfg;
237-
if (cfg.min_prb > 0 and cfg.min_prb != cfg.max_prb and rb_lims.stop() >= cfg.min_prb) {
237+
if (cfg.min_prb > 0 and cfg.min_prb != cfg.max_prb and rb_lims.stop() >= cfg.min_prb and
238+
rb_lims.stop() != cfg.max_prb) {
238239
// For the special case when minRB ratio>0, the first candidate for this slice was bounded between {RBLimsMin,
239240
// RBLimsMax}. We re-add the slice as a candidate, this time, with RB bounds {RBLimsMax, maxRB}.
240241
priority_type prio = chosen_slice.get_prio(IsDownlink, slot_count, slot_tx);

tests/unittests/scheduler/slicing/slice_scheduler_test.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ class rb_ratio_slice_scheduler_test : public slice_scheduler_test, public ::test
262262
constexpr static ran_slice_id_t default_srb_slice_id{0};
263263
constexpr static ran_slice_id_t default_drb_slice_id{1};
264264
constexpr static ran_slice_id_t drb1_slice_id{2};
265+
constexpr static ran_slice_id_t drb2_slice_id{3};
265266

266267
rb_ratio_slice_scheduler_test() :
267268
slice_scheduler_test({{{plmn_identity::test_value(), s_nssai_t{1}}, MIN_SLICE_RB, MAX_SLICE_RB},
@@ -355,7 +356,6 @@ TEST_F(rb_ratio_slice_scheduler_test,
355356
// Original slice is selected again, now using maxRB ratio as the remaining RBs.
356357
ASSERT_EQ(next_dl_slice->id(), drb1_slice_id);
357358
ASSERT_EQ(next_dl_slice->remaining_rbs(), MAX_SLICE_RB - MIN_SLICE_RB);
358-
next_dl_slice->store_grant(MAX_SLICE_RB - MIN_SLICE_RB);
359359

360360
// No more slices to schedule.
361361
next_dl_slice = slice_sched.get_next_dl_candidate();
@@ -375,7 +375,6 @@ TEST_F(rb_ratio_slice_scheduler_test,
375375
next_dl_slice = slice_sched.get_next_dl_candidate();
376376
next_dl_slice->store_grant(MIN_SLICE_RB);
377377
next_dl_slice = slice_sched.get_next_dl_candidate();
378-
next_dl_slice->store_grant(MAX_SLICE_RB - MIN_SLICE_RB);
379378
next_dl_slice = slice_sched.get_next_dl_candidate();
380379
ASSERT_FALSE(next_dl_slice.has_value());
381380

@@ -391,16 +390,13 @@ TEST_F(rb_ratio_slice_scheduler_test,
391390
next_dl_slice = slice_sched.get_next_dl_candidate();
392391
ASSERT_EQ(next_dl_slice->id(), drb1_slice_id);
393392
ASSERT_EQ(next_dl_slice->remaining_rbs(), MAX_SLICE_RB - MIN_SLICE_RB);
394-
next_dl_slice->store_grant(MAX_SLICE_RB - MIN_SLICE_RB);
395393
next_dl_slice = slice_sched.get_next_dl_candidate();
396394
ASSERT_FALSE(next_dl_slice.has_value());
397395
}
398396

399397
TEST_F(rb_ratio_slice_scheduler_test,
400398
when_slices_are_saturated_then_slices_should_have_equal_opportunity_to_reach_max_rbs)
401399
{
402-
constexpr static ran_slice_id_t drb2_slice_id{3};
403-
404400
std::initializer_list<logical_channel_config> lc_cfgs = {
405401
config_helpers::create_default_logical_channel_config(lcid_t::LCID_SRB0),
406402
config_helpers::create_default_logical_channel_config(lcid_t::LCID_SRB1),

0 commit comments

Comments
 (0)