Skip to content

Commit e40603d

Browse files
herlesupreethcodebot
authored andcommitted
sched: pass to the grid allocater the slot at which PUSCH grant to be allocated
1 parent 5600639 commit e40603d

File tree

4 files changed

+27
-21
lines changed

4 files changed

+27
-21
lines changed

lib/scheduler/policy/scheduler_time_pf.cpp

Lines changed: 4 additions & 2 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);
97+
alloc_result = try_ul_alloc(ue, ues, pusch_alloc, rem_rbs, slice_candidate.get_slot_tx());
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,10 +143,12 @@ 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)
146+
unsigned max_rbs,
147+
slot_point pusch_slot)
147148
{
148149
alloc_result alloc_result = {alloc_status::invalid_params};
149150
ue_pusch_grant grant{&ues[ctxt.ue_index], ctxt.cell_index};
151+
grant.pusch_slot = pusch_slot;
150152
// Prioritize reTx over newTx.
151153
if (ctxt.ul_retx_h != nullptr) {
152154
grant.h_id = ctxt.ul_retx_h->id;

lib/scheduler/policy/scheduler_time_pf.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,11 @@ 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
87-
try_ul_alloc(ue_ctxt& ctxt, const slice_ue_repository& ues, ue_pusch_allocator& pusch_alloc, unsigned max_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);
8891

8992
slotted_id_table<du_ue_index_t, ue_ctxt, MAX_NOF_DU_UES> ue_history_db;
9093

lib/scheduler/policy/scheduler_time_rr.cpp

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ 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,
332333
std::optional<unsigned> ul_new_tx_max_nof_rbs_per_ue_per_slot = {})
333334
{
334335
unsigned pending_newtx_bytes = 0;
@@ -358,7 +359,7 @@ static alloc_result alloc_ul_ue(const slice_ue& u,
358359

359360
// Iterate through allocation parameter candidates.
360361
for (const ul_harq_process* h_ul : harq_candidates) {
361-
ue_pusch_grant grant{&u, ue_cc.cell_index, h_ul->id};
362+
ue_pusch_grant grant{&u, ue_cc.cell_index, h_ul->id, pusch_slot};
362363
if (not is_retx) {
363364
grant.recommended_nof_bytes = pending_newtx_bytes;
364365
grant.max_nof_rbs = ul_new_tx_max_nof_rbs_per_ue_per_slot;
@@ -416,19 +417,17 @@ void scheduler_time_rr::dl_sched(ue_pdsch_allocator& pdsch_alloc,
416417
};
417418
result = round_robin_apply(ues, next_dl_ue_index, drb_newtx_ue_function);
418419
next_dl_ue_index = result.first;
419-
if (result.second == alloc_status::skip_slot) {
420-
return;
421-
}
422420
}
423421
}
424422

425423
void scheduler_time_rr::ul_sched(ue_pusch_allocator& pusch_alloc,
426424
const ue_resource_grid_view& res_grid,
427425
ul_ran_slice_candidate& slice_candidate)
428426
{
429-
const slice_ue_repository& ues = slice_candidate.get_slice_ues();
430-
const unsigned max_rbs = slice_candidate.remaining_rbs();
431-
const ran_slice_id_t slice_id = slice_candidate.id();
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();
432431

433432
if (ues.empty() or max_rbs == 0) {
434433
// No UEs to be scheduled or if there are no RBs to be scheduled in slice.
@@ -439,18 +438,20 @@ void scheduler_time_rr::ul_sched(ue_pusch_allocator& pusch_alloc,
439438
const unsigned ul_new_tx_max_nof_rbs_per_ue_per_slot =
440439
compute_max_nof_rbs_per_ue_per_slot(ues, false, res_grid, expert_cfg, max_rbs);
441440
// First, schedule UEs with pending SR.
442-
auto sr_ue_function = [this, &pusch_alloc, ul_new_tx_max_nof_rbs_per_ue_per_slot, slice_id](const slice_ue& u) {
443-
return alloc_ul_ue(u, pusch_alloc, false, true, logger, slice_id, ul_new_tx_max_nof_rbs_per_ue_per_slot);
444-
};
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+
};
445446
auto result = round_robin_apply(ues, next_ul_ue_index, sr_ue_function);
446447
next_ul_ue_index = result.first;
447448
if (result.second == alloc_status::skip_slot) {
448449
return;
449450
}
450451

451452
// Second, schedule UEs with re-transmissions.
452-
auto data_retx_ue_function = [this, &pusch_alloc, slice_id](const slice_ue& u) {
453-
return alloc_ul_ue(u, pusch_alloc, true, false, logger, slice_id);
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);
454455
};
455456
result = round_robin_apply(ues, next_ul_ue_index, data_retx_ue_function);
456457
next_ul_ue_index = result.first;
@@ -461,13 +462,11 @@ void scheduler_time_rr::ul_sched(ue_pusch_allocator& pusch_alloc,
461462
// Then, schedule UEs with new transmissions.
462463
if (ul_new_tx_max_nof_rbs_per_ue_per_slot > 0) {
463464
auto data_tx_ue_function =
464-
[this, &pusch_alloc, ul_new_tx_max_nof_rbs_per_ue_per_slot, slice_id](const slice_ue& u) {
465-
return alloc_ul_ue(u, pusch_alloc, false, false, logger, slice_id, ul_new_tx_max_nof_rbs_per_ue_per_slot);
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);
466468
};
467469
result = round_robin_apply(ues, next_ul_ue_index, data_tx_ue_function);
468470
next_ul_ue_index = result.first;
469-
if (result.second == alloc_status::skip_slot) {
470-
return;
471-
}
472471
}
473472
}

lib/scheduler/policy/ue_allocator.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ 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;
3840
/// Recommended nof. bytes to schedule. This field is not present/ignored in case of HARQ retransmission.
3941
std::optional<unsigned> recommended_nof_bytes;
4042
/// Maximum nof. RBs to allocate to the UE. This field is not present/ignored in case of HARQ retransmission.

0 commit comments

Comments
 (0)