From 64ffd81cf9b2f987b74fa80b092e59e52029c1d1 Mon Sep 17 00:00:00 2001 From: Francisco Date: Wed, 13 Oct 2021 17:39:02 +0100 Subject: [PATCH] nr,sched: fix recomputation of ue_bwp_cfg when sched receives new ue_cfg objects --- srsenb/hdr/stack/mac/nr/sched_nr_cfg.h | 16 +++++++++++---- srsenb/hdr/stack/mac/nr/sched_nr_ue.h | 3 ++- srsenb/src/stack/mac/nr/sched_nr_pdcch.cc | 6 +++--- srsenb/src/stack/mac/nr/sched_nr_ue.cc | 25 ++++++++++++----------- 4 files changed, 30 insertions(+), 20 deletions(-) diff --git a/srsenb/hdr/stack/mac/nr/sched_nr_cfg.h b/srsenb/hdr/stack/mac/nr/sched_nr_cfg.h index f905dcb99..eba8a0631 100644 --- a/srsenb/hdr/stack/mac/nr/sched_nr_cfg.h +++ b/srsenb/hdr/stack/mac/nr/sched_nr_cfg.h @@ -124,10 +124,18 @@ public: bwp_ue_cfg() = default; explicit bwp_ue_cfg(uint16_t rnti, const bwp_params_t& bwp_cfg, const ue_cfg_t& uecfg_); - const ue_cfg_t* ue_cfg() const { return cfg_; } - const srsran::phy_cfg_nr_t& phy() const { return cfg_->phy_cfg; } - const bwp_params_t& active_bwp() const { return *bwp_cfg; } - const bwp_cce_pos_list& cce_pos_list(uint32_t search_id) const + const ue_cfg_t* ue_cfg() const { return cfg_; } + const srsran::phy_cfg_nr_t& phy() const { return cfg_->phy_cfg; } + const bwp_params_t& active_bwp() const { return *bwp_cfg; } + srsran::const_span cce_pos_list(uint32_t search_id, uint32_t slot_idx, uint32_t aggr_idx) const + { + if (cce_positions_list.size() > ss_id_to_cce_idx[search_id]) { + auto& lst = cce_pos_list(search_id); + return lst[slot_idx][aggr_idx]; + } + return srsran::const_span{}; + } + const bwp_cce_pos_list& cce_pos_list(uint32_t search_id) const { return cce_positions_list[ss_id_to_cce_idx[search_id]]; } diff --git a/srsenb/hdr/stack/mac/nr/sched_nr_ue.h b/srsenb/hdr/stack/mac/nr/sched_nr_ue.h index 4104e786b..666eff1dd 100644 --- a/srsenb/hdr/stack/mac/nr/sched_nr_ue.h +++ b/srsenb/hdr/stack/mac/nr/sched_nr_ue.h @@ -63,7 +63,8 @@ class ue_carrier { public: ue_carrier(uint16_t rnti, const ue_cfg_t& cfg, const cell_params_t& cell_params_); - slot_ue try_reserve(slot_point pdcch_slot, const ue_cfg_t& uecfg_, uint32_t dl_harq_bytes, uint32_t ul_harq_bytes); + void set_cfg(const ue_cfg_t& ue_cfg); + slot_ue try_reserve(slot_point pdcch_slot, uint32_t dl_harq_bytes, uint32_t ul_harq_bytes); const uint16_t rnti; const uint32_t cc; diff --git a/srsenb/src/stack/mac/nr/sched_nr_pdcch.cc b/srsenb/src/stack/mac/nr/sched_nr_pdcch.cc index c478f05b3..2d54546d0 100644 --- a/srsenb/src/stack/mac/nr/sched_nr_pdcch.cc +++ b/srsenb/src/stack/mac/nr/sched_nr_pdcch.cc @@ -179,9 +179,9 @@ srsran::span coreset_region::get_cce_loc_table(const alloc_recor { switch (record.alloc_type) { case pdcch_grant_type_t::dl_data: - return record.ue->cfg->cce_pos_list(record.ss_id)[slot_idx][record.aggr_idx]; + return record.ue->cfg->cce_pos_list(record.ss_id, slot_idx, record.aggr_idx); case pdcch_grant_type_t::ul_data: - return record.ue->cfg->cce_pos_list(record.ss_id)[slot_idx][record.aggr_idx]; + return record.ue->cfg->cce_pos_list(record.ss_id, slot_idx, record.aggr_idx); case pdcch_grant_type_t::rar: return rar_cce_list[slot_idx][record.aggr_idx]; default: @@ -191,4 +191,4 @@ srsran::span coreset_region::get_cce_loc_table(const alloc_recor } } // namespace sched_nr_impl -} // namespace srsenb \ No newline at end of file +} // namespace srsenb diff --git a/srsenb/src/stack/mac/nr/sched_nr_ue.cc b/srsenb/src/stack/mac/nr/sched_nr_ue.cc index 011591756..ed0349a0d 100644 --- a/srsenb/src/stack/mac/nr/sched_nr_ue.cc +++ b/srsenb/src/stack/mac/nr/sched_nr_ue.cc @@ -29,17 +29,14 @@ ue_carrier::ue_carrier(uint16_t rnti_, const ue_cfg_t& uecfg_, const cell_params harq_ent(cell_params_.nof_prb()) {} -slot_ue ue_carrier::try_reserve(slot_point pdcch_slot, - const ue_cfg_t& uecfg_, - uint32_t dl_pending_bytes, - uint32_t ul_pending_bytes) +void ue_carrier::set_cfg(const ue_cfg_t& ue_cfg) { - slot_point slot_rx = pdcch_slot - TX_ENB_DELAY; + bwp_cfg = bwp_ue_cfg(rnti, cell_params.bwps[0], ue_cfg); +} - // update CC/BWP config if there were changes - if (bwp_cfg.ue_cfg() != &uecfg_) { - bwp_cfg = bwp_ue_cfg(rnti, cell_params.bwps[0], uecfg_); - } +slot_ue ue_carrier::try_reserve(slot_point pdcch_slot, uint32_t dl_pending_bytes, uint32_t ul_pending_bytes) +{ + slot_point slot_rx = pdcch_slot - TX_ENB_DELAY; // copy cc-specific parameters and find available HARQs slot_ue sfu(rnti, slot_rx, cc); @@ -90,8 +87,12 @@ void ue::set_cfg(const ue_cfg_t& cfg) { ue_cfg = cfg; for (auto& ue_cc_cfg : cfg.carriers) { - if (ue_cc_cfg.active and carriers[ue_cc_cfg.cc] == nullptr) { - carriers[ue_cc_cfg.cc].reset(new ue_carrier(rnti, cfg, sched_cfg.cells[ue_cc_cfg.cc])); + if (ue_cc_cfg.active) { + if (carriers[ue_cc_cfg.cc] == nullptr) { + carriers[ue_cc_cfg.cc].reset(new ue_carrier(rnti, cfg, sched_cfg.cells[ue_cc_cfg.cc])); + } else { + carriers[ue_cc_cfg.cc]->set_cfg(ue_cfg); + } } } @@ -147,7 +148,7 @@ slot_ue ue::try_reserve(slot_point pdcch_slot, uint32_t cc) return slot_ue(); } - return carriers[cc]->try_reserve(pdcch_slot, cfg(), dl_pending_bytes, ul_pending_bytes); + return carriers[cc]->try_reserve(pdcch_slot, dl_pending_bytes, ul_pending_bytes); } } // namespace sched_nr_impl