sched,nr: use real ra-WindowSize in NR scheduler

master
Francisco Paisana 3 years ago
parent 3217c00cfc
commit 9855450a4a

@ -23,12 +23,6 @@ namespace sched_nr_impl {
using dl_sched_rar_info_t = sched_nr_interface::dl_sched_rar_info_t; using dl_sched_rar_info_t = sched_nr_interface::dl_sched_rar_info_t;
struct pending_rar_t {
uint16_t ra_rnti = 0;
slot_point prach_slot;
srsran::bounded_vector<dl_sched_rar_info_t, sched_interface::MAX_RAR_LIST> msg3_grant;
};
/// RAR/Msg3 scheduler /// RAR/Msg3 scheduler
class ra_sched class ra_sched
{ {
@ -40,6 +34,13 @@ public:
size_t empty() const { return pending_rars.empty(); } size_t empty() const { return pending_rars.empty(); }
private: private:
struct pending_rar_t {
uint16_t ra_rnti = 0;
slot_point prach_slot;
slot_interval rar_win;
srsran::bounded_vector<dl_sched_rar_info_t, sched_interface::MAX_RAR_LIST> msg3_grant;
};
alloc_result allocate_pending_rar(bwp_slot_allocator& slot_grid, alloc_result allocate_pending_rar(bwp_slot_allocator& slot_grid,
const pending_rar_t& rar, const pending_rar_t& rar,
slot_ue_map_t& slot_ues, slot_ue_map_t& slot_ues,

@ -23,7 +23,7 @@
namespace srsenb { namespace srsenb {
namespace sched_nr_impl { namespace sched_nr_impl {
struct pending_rar_t; using dl_sched_rar_info_t = sched_nr_interface::dl_sched_rar_info_t;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -83,11 +83,11 @@ public:
void new_slot(slot_point pdcch_slot_) { pdcch_slot = pdcch_slot_; } void new_slot(slot_point pdcch_slot_) { pdcch_slot = pdcch_slot_; }
alloc_result alloc_rar_and_msg3(uint32_t aggr_idx, alloc_result alloc_rar_and_msg3(uint16_t ra_rnti,
const pending_rar_t& rar, uint32_t aggr_idx,
prb_interval interv, prb_interval interv,
slot_ue_map_t& ues, slot_ue_map_t& ues,
uint32_t max_nof_grants); srsran::const_span<dl_sched_rar_info_t> pending_rars);
alloc_result alloc_pdsch(slot_ue& ue, const prb_grant& dl_grant); alloc_result alloc_pdsch(slot_ue& ue, const prb_grant& dl_grant);
alloc_result alloc_pusch(slot_ue& ue, const prb_grant& dl_mask); alloc_result alloc_pusch(slot_ue& ue, const prb_grant& dl_mask);

@ -54,7 +54,7 @@ public:
srsran_pdcch_cfg_nr_t pdcch = {}; srsran_pdcch_cfg_nr_t pdcch = {};
srsran_sch_hl_cfg_nr_t pdsch = {}; srsran_sch_hl_cfg_nr_t pdsch = {};
srsran_sch_hl_cfg_nr_t pusch = {}; srsran_sch_hl_cfg_nr_t pusch = {};
uint32_t rar_window_size = 3; uint32_t rar_window_size = 8;
}; };
struct cell_cfg_t { struct cell_cfg_t {

@ -27,7 +27,8 @@ alloc_result ra_sched::allocate_pending_rar(bwp_slot_allocator& slot_grid,
const uint32_t rar_aggr_level = 2; const uint32_t rar_aggr_level = 2;
const prb_bitmap& prbs = slot_grid.res_grid()[slot_grid.get_pdcch_tti()].dl_prbs.prbs(); const prb_bitmap& prbs = slot_grid.res_grid()[slot_grid.get_pdcch_tti()].dl_prbs.prbs();
alloc_result ret = alloc_result::other_cause; alloc_result ret = alloc_result::other_cause;
srsran::const_span<dl_sched_rar_info_t> msg3_grants{rar.msg3_grant};
for (nof_grants_alloc = rar.msg3_grant.size(); nof_grants_alloc > 0; nof_grants_alloc--) { for (nof_grants_alloc = rar.msg3_grant.size(); nof_grants_alloc > 0; nof_grants_alloc--) {
ret = alloc_result::invalid_coderate; ret = alloc_result::invalid_coderate;
uint32_t start_prb_idx = 0; uint32_t start_prb_idx = 0;
@ -35,7 +36,8 @@ alloc_result ra_sched::allocate_pending_rar(bwp_slot_allocator& slot_grid,
prb_interval interv = find_empty_interval_of_length(prbs, nprb, start_prb_idx); prb_interval interv = find_empty_interval_of_length(prbs, nprb, start_prb_idx);
start_prb_idx = interv.stop(); start_prb_idx = interv.stop();
if (interv.length() == nprb) { if (interv.length() == nprb) {
ret = slot_grid.alloc_rar_and_msg3(rar_aggr_level, rar, interv, slot_ues, nof_grants_alloc); ret = slot_grid.alloc_rar_and_msg3(
rar.ra_rnti, rar_aggr_level, interv, slot_ues, msg3_grants.subspan(0, nof_grants_alloc));
} else { } else {
ret = alloc_result::no_sch_space; ret = alloc_result::no_sch_space;
} }
@ -56,7 +58,19 @@ void ra_sched::run_slot(bwp_slot_allocator& slot_grid, slot_ue_map_t& slot_ues)
{ {
slot_point pdcch_slot = slot_grid.get_pdcch_tti(); slot_point pdcch_slot = slot_grid.get_pdcch_tti();
slot_point msg3_slot = pdcch_slot + bwp_cfg->pusch_ra_list[0].msg3_delay; slot_point msg3_slot = pdcch_slot + bwp_cfg->pusch_ra_list[0].msg3_delay;
if (not slot_grid.res_grid()[pdcch_slot].is_dl or not slot_grid.res_grid()[msg3_slot].is_ul) { if (not slot_grid.res_grid()[pdcch_slot].is_dl) {
// RAR only allowed if PDCCH is available
return;
}
// Mark RAR window start, regardless of whether PUSCH is available
for (auto& rar : pending_rars) {
if (rar.rar_win.empty()) {
rar.rar_win = {pdcch_slot, pdcch_slot + bwp_cfg->cfg.rar_window_size};
}
}
if (not slot_grid.res_grid()[msg3_slot].is_ul) {
// RAR only allowed if respective Msg3 slot is available for UL // RAR only allowed if respective Msg3 slot is available for UL
return; return;
} }
@ -67,14 +81,12 @@ void ra_sched::run_slot(bwp_slot_allocator& slot_grid, slot_ue_map_t& slot_ues)
// In case of RAR outside RAR window: // In case of RAR outside RAR window:
// - if window has passed, discard RAR // - if window has passed, discard RAR
// - if window hasn't started, stop loop, as RARs are ordered by TTI // - if window hasn't started, stop loop, as RARs are ordered by TTI
slot_point tti_start{0, rar.prach_slot.sfn(), 0}; if (not rar.rar_win.contains(pdcch_slot)) {
slot_interval rar_window{tti_start, tti_start + 2 * tti_start.nof_slots_per_frame()}; // TODO: use rar_window_size if (pdcch_slot >= rar.rar_win.stop()) {
if (not rar_window.contains(pdcch_slot)) {
if (pdcch_slot >= rar_window.stop()) {
fmt::memory_buffer str_buffer; fmt::memory_buffer str_buffer;
fmt::format_to(str_buffer, fmt::format_to(str_buffer,
"SCHED: Could not transmit RAR within the window Window={}, PRACH={}, RAR={}", "SCHED: Could not transmit RAR within the window Window={}, PRACH={}, RAR={}",
rar_window, rar.rar_win,
rar.prach_slot, rar.prach_slot,
pdcch_slot); pdcch_slot);
srsran::console("%s\n", srsran::to_c_str(str_buffer)); srsran::console("%s\n", srsran::to_c_str(str_buffer));

@ -64,11 +64,11 @@ bwp_slot_allocator::bwp_slot_allocator(bwp_res_grid& bwp_grid_) :
logger(srslog::fetch_basic_logger("MAC")), cfg(*bwp_grid_.cfg), bwp_grid(bwp_grid_) logger(srslog::fetch_basic_logger("MAC")), cfg(*bwp_grid_.cfg), bwp_grid(bwp_grid_)
{} {}
alloc_result bwp_slot_allocator::alloc_rar_and_msg3(uint32_t aggr_idx, alloc_result bwp_slot_allocator::alloc_rar_and_msg3(uint16_t ra_rnti,
const srsenb::sched_nr_impl::pending_rar_t& rar, uint32_t aggr_idx,
prb_interval interv, prb_interval interv,
slot_ue_map_t& ues, slot_ue_map_t& ues,
uint32_t max_nof_grants) srsran::const_span<dl_sched_rar_info_t> pending_rars)
{ {
static const uint32_t msg3_nof_prbs = 3, m = 0; static const uint32_t msg3_nof_prbs = 3, m = 0;
@ -95,7 +95,7 @@ alloc_result bwp_slot_allocator::alloc_rar_and_msg3(uint32_t
} }
// Check Msg3 RB collision // Check Msg3 RB collision
uint32_t total_ul_nof_prbs = msg3_nof_prbs * max_nof_grants; uint32_t total_ul_nof_prbs = msg3_nof_prbs * pending_rars.size();
uint32_t total_ul_nof_rbgs = srsran::ceil_div(total_ul_nof_prbs, get_P(bwp_grid.nof_prbs(), false)); uint32_t total_ul_nof_rbgs = srsran::ceil_div(total_ul_nof_prbs, get_P(bwp_grid.nof_prbs(), false));
prb_interval msg3_rbs = find_empty_interval_of_length(bwp_msg3_slot.ul_prbs.prbs(), total_ul_nof_rbgs); prb_interval msg3_rbs = find_empty_interval_of_length(bwp_msg3_slot.ul_prbs.prbs(), total_ul_nof_rbgs);
if (msg3_rbs.length() < total_ul_nof_rbgs) { if (msg3_rbs.length() < total_ul_nof_rbgs) {
@ -114,9 +114,9 @@ alloc_result bwp_slot_allocator::alloc_rar_and_msg3(uint32_t
// RAR allocation successful. // RAR allocation successful.
// Generate DCI for RAR // Generate DCI for RAR with given RA-RNTI
pdcch_dl_t& pdcch = bwp_pdcch_slot.dl_pdcchs.back(); pdcch_dl_t& pdcch = bwp_pdcch_slot.dl_pdcchs.back();
if (not fill_dci_rar(interv, rar.ra_rnti, *bwp_grid.cfg, pdcch.dci)) { if (not fill_dci_rar(interv, ra_rnti, *bwp_grid.cfg, pdcch.dci)) {
// Cancel on-going PDCCH allocation // Cancel on-going PDCCH allocation
bwp_pdcch_slot.coresets[coreset_id]->rem_last_dci(); bwp_pdcch_slot.coresets[coreset_id]->rem_last_dci();
return alloc_result::invalid_coderate; return alloc_result::invalid_coderate;
@ -130,7 +130,7 @@ alloc_result bwp_slot_allocator::alloc_rar_and_msg3(uint32_t
int dai = 0; int dai = 0;
srsran_slot_cfg_t slot_cfg; srsran_slot_cfg_t slot_cfg;
slot_cfg.idx = msg3_slot.slot_idx(); slot_cfg.idx = msg3_slot.slot_idx();
for (const auto& grant : rar.msg3_grant) { for (const dl_sched_rar_info_t& grant : pending_rars) {
slot_ue& ue = ues[grant.temp_crnti]; slot_ue& ue = ues[grant.temp_crnti];
prb_interval msg3_interv{last_msg3, last_msg3 + msg3_nof_prbs}; prb_interval msg3_interv{last_msg3, last_msg3 + msg3_nof_prbs};
ue.h_ul = ue.harq_ent->find_empty_ul_harq(); ue.h_ul = ue.harq_ent->find_empty_ul_harq();

Loading…
Cancel
Save