From 5f36b9b1167206a95f8ebd1bba93693cc14759b5 Mon Sep 17 00:00:00 2001 From: Francisco Date: Sun, 5 Dec 2021 14:42:57 +0000 Subject: [PATCH] nr,gnb,sched: rename pdcch scheduler to pdcch allocator --- .../hdr/stack/mac/sched_nr_grant_allocator.h | 12 +++--- srsgnb/hdr/stack/mac/sched_nr_pdcch.h | 19 +++++---- srsgnb/src/stack/mac/sched_nr_pdcch.cc | 42 +++++++++---------- 3 files changed, 39 insertions(+), 34 deletions(-) diff --git a/srsgnb/hdr/stack/mac/sched_nr_grant_allocator.h b/srsgnb/hdr/stack/mac/sched_nr_grant_allocator.h index 1cd6812b9..f82f9fb89 100644 --- a/srsgnb/hdr/stack/mac/sched_nr_grant_allocator.h +++ b/srsgnb/hdr/stack/mac/sched_nr_grant_allocator.h @@ -47,12 +47,12 @@ struct bwp_slot_grid { uint32_t slot_idx = 0; const bwp_params_t* cfg = nullptr; - bwp_rb_bitmap dl_prbs; - bwp_rb_bitmap ul_prbs; - dl_sched_res_t dl; - ul_sched_t ul; - harq_ack_list_t pending_acks; - pdcch_scheduler pdcch_sched; /// slot PDCCH resource scheduler + bwp_rb_bitmap dl_prbs; + bwp_rb_bitmap ul_prbs; + dl_sched_res_t dl; + ul_sched_t ul; + harq_ack_list_t pending_acks; + bwp_pdcch_allocator pdcch_sched; /// slot PDCCH resource allocator srsran::unique_pool_ptr rar_softbuffer; diff --git a/srsgnb/hdr/stack/mac/sched_nr_pdcch.h b/srsgnb/hdr/stack/mac/sched_nr_pdcch.h index 5e25d5a8b..5a6a2e5f6 100644 --- a/srsgnb/hdr/stack/mac/sched_nr_pdcch.h +++ b/srsgnb/hdr/stack/mac/sched_nr_pdcch.h @@ -94,14 +94,20 @@ private: bool get_next_dfs(); }; -class pdcch_scheduler +/** + * Class to handle the allocation of REs for a BWP PDCCH in a specific slot + */ +class bwp_pdcch_allocator { public: - pdcch_scheduler(const bwp_params_t& bwp_cfg_, - uint32_t slot_idx, - pdcch_dl_list_t& pdcch_dl_list, - pdcch_ul_list_t& pdcch_ul_list); + bwp_pdcch_allocator(const bwp_params_t& bwp_cfg_, + uint32_t slot_idx, + pdcch_dl_list_t& pdcch_dl_list, + pdcch_ul_list_t& pdcch_ul_list); + /** + * Clear current slot allocations + */ void reset(); /** @@ -133,8 +139,7 @@ public: void rem_last_pdcch(uint32_t ss_id); private: - const static size_t MAX_CORESET_PER_BWP = 3; /// limit set in TS 38.331, ControlResourceSetId - using slot_coreset_list = std::array, MAX_CORESET_PER_BWP>; + using slot_coreset_list = srsran::optional_vector; bool check_args_valid(uint32_t ss_id, uint32_t aggr_idx, const ue_carrier_params_t* user, bool is_dl) const; diff --git a/srsgnb/src/stack/mac/sched_nr_pdcch.cc b/srsgnb/src/stack/mac/sched_nr_pdcch.cc index dffa002a8..cc5f2b3fc 100644 --- a/srsgnb/src/stack/mac/sched_nr_pdcch.cc +++ b/srsgnb/src/stack/mac/sched_nr_pdcch.cc @@ -192,25 +192,25 @@ srsran::span coreset_region::get_cce_loc_table(const alloc_recor return {}; } -pdcch_scheduler::pdcch_scheduler(const bwp_params_t& bwp_cfg_, - uint32_t slot_idx_, - pdcch_dl_list_t& dl_pdcchs, - pdcch_ul_list_t& ul_pdcchs) : +bwp_pdcch_allocator::bwp_pdcch_allocator(const bwp_params_t& bwp_cfg_, + uint32_t slot_idx_, + pdcch_dl_list_t& dl_pdcchs, + pdcch_ul_list_t& ul_pdcchs) : bwp_cfg(bwp_cfg_), pdcch_dl_list(dl_pdcchs), pdcch_ul_list(ul_pdcchs), slot_idx(slot_idx_), logger(bwp_cfg_.logger) { for (uint32_t cs_idx = 0; cs_idx < SRSRAN_UE_DL_NR_MAX_NOF_CORESET; ++cs_idx) { if (bwp_cfg.cfg.pdcch.coreset_present[cs_idx]) { uint32_t cs_id = bwp_cfg.cfg.pdcch.coreset[cs_idx].id; - coresets[cs_id].emplace(bwp_cfg, cs_id, slot_idx, pdcch_dl_list, pdcch_ul_list); + coresets.emplace(cs_id, bwp_cfg, cs_id, slot_idx, pdcch_dl_list, pdcch_ul_list); } } } /// Helper function to verify valid inputs -bool pdcch_scheduler::check_args_valid(uint32_t ss_id, - uint32_t aggr_idx, - const ue_carrier_params_t* user, - bool is_dl) const +bool bwp_pdcch_allocator::check_args_valid(uint32_t ss_id, + uint32_t aggr_idx, + const ue_carrier_params_t* user, + bool is_dl) const { srsran_assert(ss_id < SRSRAN_UE_DL_NR_MAX_NOF_SEARCH_SPACE, "Invalid SearchSpace#%d", ss_id); srsran_assert( @@ -248,10 +248,10 @@ bool pdcch_scheduler::check_args_valid(uint32_t ss_id, return true; } -pdcch_dl_t* pdcch_scheduler::alloc_dl_pdcch(pdcch_grant_type_t alloc_type, - uint32_t ss_id, - uint32_t aggr_idx, - const ue_carrier_params_t* user) +pdcch_dl_t* bwp_pdcch_allocator::alloc_dl_pdcch(pdcch_grant_type_t alloc_type, + uint32_t ss_id, + uint32_t aggr_idx, + const ue_carrier_params_t* user) { if (not check_args_valid(ss_id, aggr_idx, user, true)) { return nullptr; @@ -263,38 +263,38 @@ pdcch_dl_t* pdcch_scheduler::alloc_dl_pdcch(pdcch_grant_type_t alloc_typ "PDCCH grant type does not match search space"); } - if (coresets[ss.coreset_id]->alloc_pdcch(alloc_type, aggr_idx, ss_id, user)) { + if (coresets[ss.coreset_id].alloc_pdcch(alloc_type, aggr_idx, ss_id, user)) { return &pdcch_dl_list.back(); } return nullptr; } -pdcch_ul_t* pdcch_scheduler::alloc_ul_pdcch(uint32_t ss_id, uint32_t aggr_idx, const ue_carrier_params_t* user) +pdcch_ul_t* bwp_pdcch_allocator::alloc_ul_pdcch(uint32_t ss_id, uint32_t aggr_idx, const ue_carrier_params_t* user) { if (not check_args_valid(ss_id, aggr_idx, user, false)) { return nullptr; } const srsran_search_space_t& ss = *user->get_ss(ss_id); - if (coresets[ss.coreset_id]->alloc_pdcch(pdcch_grant_type_t::ul_data, aggr_idx, ss_id, user)) { + if (coresets[ss.coreset_id].alloc_pdcch(pdcch_grant_type_t::ul_data, aggr_idx, ss_id, user)) { return &pdcch_ul_list.back(); } return nullptr; } -void pdcch_scheduler::rem_last_pdcch(uint32_t ss_id) +void bwp_pdcch_allocator::rem_last_pdcch(uint32_t ss_id) { const srsran_search_space_t& ss = bwp_cfg.cfg.pdcch.search_space[ss_id]; uint32_t coreset_id = ss.coreset_id; - coresets[coreset_id]->rem_last_pdcch(); + coresets[coreset_id].rem_last_pdcch(); } -void pdcch_scheduler::reset() +void bwp_pdcch_allocator::reset() { for (uint32_t i = 0; i < coresets.size(); ++i) { - if (coresets[i].has_value()) { - coresets[i]->reset(); + if (coresets.contains(i)) { + coresets[i].reset(); } } }