Skip to content

Commit fe3204a

Browse files
herlesupreethcodebot
authored andcommitted
sched: refactor passing of slot at which PUSCH needs to be allocated
1 parent 537ff57 commit fe3204a

File tree

7 files changed

+59
-68
lines changed

7 files changed

+59
-68
lines changed

lib/scheduler/policy/scheduler_time_pf.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ void scheduler_time_pf::ul_sched(ue_pusch_allocator& pusch_alloc,
9494
while (not ul_queue.empty() and rem_rbs > 0) {
9595
ue_ctxt& ue = *ul_queue.top();
9696
if (alloc_result.status != alloc_status::skip_slot) {
97-
alloc_result = try_ul_alloc(ue, ues, pusch_alloc, rem_rbs, slice_candidate.get_slot_tx());
97+
alloc_result = try_ul_alloc(ue, ues, pusch_alloc, rem_rbs);
9898
}
9999
ue.save_ul_alloc(alloc_result.alloc_bytes);
100100
// Re-add the UE to the queue if scheduling of re-transmission fails so that scheduling of retransmission are
@@ -143,12 +143,10 @@ alloc_result scheduler_time_pf::try_dl_alloc(ue_ctxt& ctxt,
143143
alloc_result scheduler_time_pf::try_ul_alloc(ue_ctxt& ctxt,
144144
const slice_ue_repository& ues,
145145
ue_pusch_allocator& pusch_alloc,
146-
unsigned max_rbs,
147-
slot_point pusch_slot)
146+
unsigned max_rbs)
148147
{
149148
alloc_result alloc_result = {alloc_status::invalid_params};
150149
ue_pusch_grant grant{&ues[ctxt.ue_index], ctxt.cell_index};
151-
grant.pusch_slot = pusch_slot;
152150
// Prioritize reTx over newTx.
153151
if (ctxt.ul_retx_h != nullptr) {
154152
grant.h_id = ctxt.ul_retx_h->id;

lib/scheduler/policy/scheduler_time_pf.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,8 @@ class scheduler_time_pf : public scheduler_policy
8383
try_dl_alloc(ue_ctxt& ctxt, const slice_ue_repository& ues, ue_pdsch_allocator& pdsch_alloc, unsigned max_rbs);
8484
/// \brief Attempts to allocate PUSCH for a UE.
8585
/// \return Returns allocation status, nof. allocated bytes and nof. allocated RBs.
86-
alloc_result try_ul_alloc(ue_ctxt& ctxt,
87-
const slice_ue_repository& ues,
88-
ue_pusch_allocator& pusch_alloc,
89-
unsigned max_rbs,
90-
slot_point pusch_slot);
86+
alloc_result
87+
try_ul_alloc(ue_ctxt& ctxt, const slice_ue_repository& ues, ue_pusch_allocator& pusch_alloc, unsigned max_rbs);
9188

9289
slotted_id_table<du_ue_index_t, ue_ctxt, MAX_NOF_DU_UES> ue_history_db;
9390

lib/scheduler/policy/scheduler_time_rr.cpp

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,6 @@ static alloc_result alloc_ul_ue(const slice_ue& u,
329329
bool schedule_sr_only,
330330
srslog::basic_logger& logger,
331331
ran_slice_id_t slice_id,
332-
slot_point pusch_slot,
333332
std::optional<unsigned> ul_new_tx_max_nof_rbs_per_ue_per_slot = {})
334333
{
335334
unsigned pending_newtx_bytes = 0;
@@ -359,7 +358,7 @@ static alloc_result alloc_ul_ue(const slice_ue& u,
359358

360359
// Iterate through allocation parameter candidates.
361360
for (const ul_harq_process* h_ul : harq_candidates) {
362-
ue_pusch_grant grant{&u, ue_cc.cell_index, h_ul->id, pusch_slot};
361+
ue_pusch_grant grant{&u, ue_cc.cell_index, h_ul->id};
363362
if (not is_retx) {
364363
grant.recommended_nof_bytes = pending_newtx_bytes;
365364
grant.max_nof_rbs = ul_new_tx_max_nof_rbs_per_ue_per_slot;
@@ -424,10 +423,9 @@ void scheduler_time_rr::ul_sched(ue_pusch_allocator& pusch_alloc,
424423
const ue_resource_grid_view& res_grid,
425424
ul_ran_slice_candidate& slice_candidate)
426425
{
427-
const slice_ue_repository& ues = slice_candidate.get_slice_ues();
428-
const unsigned max_rbs = slice_candidate.remaining_rbs();
429-
const ran_slice_id_t slice_id = slice_candidate.id();
430-
const slot_point pusch_slot = slice_candidate.get_slot_tx();
426+
const slice_ue_repository& ues = slice_candidate.get_slice_ues();
427+
const unsigned max_rbs = slice_candidate.remaining_rbs();
428+
const ran_slice_id_t slice_id = slice_candidate.id();
431429

432430
if (ues.empty() or max_rbs == 0) {
433431
// No UEs to be scheduled or if there are no RBs to be scheduled in slice.
@@ -438,20 +436,18 @@ void scheduler_time_rr::ul_sched(ue_pusch_allocator& pusch_alloc,
438436
const unsigned ul_new_tx_max_nof_rbs_per_ue_per_slot =
439437
compute_max_nof_rbs_per_ue_per_slot(ues, false, res_grid, expert_cfg, max_rbs);
440438
// First, schedule UEs with pending SR.
441-
auto sr_ue_function =
442-
[this, &pusch_alloc, ul_new_tx_max_nof_rbs_per_ue_per_slot, slice_id, pusch_slot](const slice_ue& u) {
443-
return alloc_ul_ue(
444-
u, pusch_alloc, false, true, logger, slice_id, pusch_slot, ul_new_tx_max_nof_rbs_per_ue_per_slot);
445-
};
439+
auto sr_ue_function = [this, &pusch_alloc, ul_new_tx_max_nof_rbs_per_ue_per_slot, slice_id](const slice_ue& u) {
440+
return alloc_ul_ue(u, pusch_alloc, false, true, logger, slice_id, ul_new_tx_max_nof_rbs_per_ue_per_slot);
441+
};
446442
auto result = round_robin_apply(ues, next_ul_ue_index, sr_ue_function);
447443
next_ul_ue_index = result.first;
448444
if (result.second == alloc_status::skip_slot) {
449445
return;
450446
}
451447

452448
// Second, schedule UEs with re-transmissions.
453-
auto data_retx_ue_function = [this, &pusch_alloc, slice_id, pusch_slot](const slice_ue& u) {
454-
return alloc_ul_ue(u, pusch_alloc, true, false, logger, slice_id, pusch_slot);
449+
auto data_retx_ue_function = [this, &pusch_alloc, slice_id](const slice_ue& u) {
450+
return alloc_ul_ue(u, pusch_alloc, true, false, logger, slice_id);
455451
};
456452
result = round_robin_apply(ues, next_ul_ue_index, data_retx_ue_function);
457453
next_ul_ue_index = result.first;
@@ -462,9 +458,8 @@ void scheduler_time_rr::ul_sched(ue_pusch_allocator& pusch_alloc,
462458
// Then, schedule UEs with new transmissions.
463459
if (ul_new_tx_max_nof_rbs_per_ue_per_slot > 0) {
464460
auto data_tx_ue_function =
465-
[this, &pusch_alloc, ul_new_tx_max_nof_rbs_per_ue_per_slot, slice_id, pusch_slot](const slice_ue& u) {
466-
return alloc_ul_ue(
467-
u, pusch_alloc, false, false, logger, slice_id, pusch_slot, ul_new_tx_max_nof_rbs_per_ue_per_slot);
461+
[this, &pusch_alloc, ul_new_tx_max_nof_rbs_per_ue_per_slot, slice_id](const slice_ue& u) {
462+
return alloc_ul_ue(u, pusch_alloc, false, false, logger, slice_id, ul_new_tx_max_nof_rbs_per_ue_per_slot);
468463
};
469464
result = round_robin_apply(ues, next_ul_ue_index, data_tx_ue_function);
470465
next_ul_ue_index = result.first;

lib/scheduler/policy/ue_allocator.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ struct ue_pusch_grant {
3535
const slice_ue* user;
3636
du_cell_index_t cell_index;
3737
harq_id_t h_id;
38-
/// Slot at which PUSCH grant needs to be allocated.
39-
slot_point pusch_slot;
4038
/// Recommended nof. bytes to schedule. This field is not present/ignored in case of HARQ retransmission.
4139
std::optional<unsigned> recommended_nof_bytes;
4240
/// Maximum nof. RBs to allocate to the UE. This field is not present/ignored in case of HARQ retransmission.

lib/scheduler/ue_scheduling/ue_cell_grid_allocator.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,8 @@ alloc_result ue_cell_grid_allocator::allocate_dl_grant(const ue_pdsch_grant& gra
483483
return {alloc_status::invalid_params};
484484
}
485485

486-
alloc_result ue_cell_grid_allocator::allocate_ul_grant(const ue_pusch_grant& grant, ran_slice_id_t slice_id)
486+
alloc_result
487+
ue_cell_grid_allocator::allocate_ul_grant(const ue_pusch_grant& grant, ran_slice_id_t slice_id, slot_point pusch_slot)
487488
{
488489
srsran_assert(ues.contains(grant.user->ue_index()), "Invalid UE candidate index={}", grant.user->ue_index());
489490
srsran_assert(has_cell(grant.cell_index), "Invalid UE candidate cell_index={}", grant.cell_index);
@@ -554,8 +555,6 @@ alloc_result ue_cell_grid_allocator::allocate_ul_grant(const ue_pusch_grant& gra
554555
return {alloc_status::invalid_params};
555556
}
556557

557-
slot_point pusch_slot = grant.pusch_slot;
558-
559558
// Create PUSCH param candidate search object.
560559
ue_pusch_alloc_param_candidate_searcher candidates{
561560
u, grant.cell_index, h_ul, pdcch_alloc.slot, slots_with_no_pusch_space, pusch_slot};

lib/scheduler/ue_scheduling/ue_cell_grid_allocator.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class ue_cell_grid_allocator
4040

4141
alloc_result allocate_dl_grant(const ue_pdsch_grant& grant, ran_slice_id_t slice_id);
4242

43-
alloc_result allocate_ul_grant(const ue_pusch_grant& grant, ran_slice_id_t slice_id);
43+
alloc_result allocate_ul_grant(const ue_pusch_grant& grant, ran_slice_id_t slice_id, slot_point pusch_slot);
4444

4545
private:
4646
struct cell_t {
@@ -114,7 +114,8 @@ class ul_slice_ue_cell_grid_allocator : public ue_pusch_allocator
114114

115115
alloc_result allocate_ul_grant(const ue_pusch_grant& grant) override
116116
{
117-
const alloc_result result = pusch_alloc.allocate_ul_grant(grant, slice_candidate.id());
117+
const alloc_result result =
118+
pusch_alloc.allocate_ul_grant(grant, slice_candidate.id(), slice_candidate.get_slot_tx());
118119
if (result.status == alloc_status::success) {
119120
slice_candidate.store_grant(result.alloc_nof_rbs);
120121
}

0 commit comments

Comments
 (0)