diff --git a/srsenb/hdr/stack/mac/nr/sched_nr_cfg.h b/srsenb/hdr/stack/mac/nr/sched_nr_cfg.h index b2295c2fc..be7e2657c 100644 --- a/srsenb/hdr/stack/mac/nr/sched_nr_cfg.h +++ b/srsenb/hdr/stack/mac/nr/sched_nr_cfg.h @@ -15,10 +15,11 @@ #include "sched_nr_interface.h" #include "sched_nr_rb.h" +#include "srsenb/hdr/common/common_enb.h" namespace srsenb { -const static size_t SCHED_NR_MAX_USERS = 4; +const static size_t SCHED_NR_MAX_USERS = SRSENB_MAX_UES; const static size_t SCHED_NR_NOF_SUBFRAMES = 10; const static size_t SCHED_NR_NOF_HARQS = 16; static const size_t MAX_NOF_AGGR_LEVELS = 5; diff --git a/srsenb/hdr/stack/mac/nr/sched_nr_ue.h b/srsenb/hdr/stack/mac/nr/sched_nr_ue.h index 044d10fdd..4b1ab12bf 100644 --- a/srsenb/hdr/stack/mac/nr/sched_nr_ue.h +++ b/srsenb/hdr/stack/mac/nr/sched_nr_ue.h @@ -114,8 +114,8 @@ private: ue_cfg_t ue_cfg; }; -using ue_map_t = srsran::static_circular_map, SCHED_NR_MAX_USERS>; -using slot_ue_map_t = srsran::static_circular_map; +using ue_map_t = rnti_map_t >; +using slot_ue_map_t = rnti_map_t; } // namespace sched_nr_impl diff --git a/srsenb/hdr/stack/mac/nr/sched_nr_worker.h b/srsenb/hdr/stack/mac/nr/sched_nr_worker.h index fb739f6fd..2dc4c8141 100644 --- a/srsenb/hdr/stack/mac/nr/sched_nr_worker.h +++ b/srsenb/hdr/stack/mac/nr/sched_nr_worker.h @@ -101,7 +101,7 @@ public: } private: - void update_ue_db(slot_point slot_tx, bool update_ca_users); + void update_ue_db(slot_point slot_tx, bool locked_context); bool save_sched_result(slot_point pdcch_slot, uint32_t cc, dl_sched_res_t& dl_res, ul_sched_t& ul_res); diff --git a/srsenb/src/stack/mac/nr/sched_nr.cc b/srsenb/src/stack/mac/nr/sched_nr.cc index 721b18a66..7bfcdd521 100644 --- a/srsenb/src/stack/mac/nr/sched_nr.cc +++ b/srsenb/src/stack/mac/nr/sched_nr.cc @@ -98,7 +98,12 @@ void sched_nr::ue_cfg(uint16_t rnti, const ue_cfg_t& uecfg) void sched_nr::ue_cfg_impl(uint16_t rnti, const ue_cfg_t& uecfg) { if (not ue_db.contains(rnti)) { - ue_db.insert(rnti, std::unique_ptr(new ue{rnti, uecfg, cfg})); + auto ret = ue_db.insert(rnti, std::unique_ptr(new ue{rnti, uecfg, cfg})); + if (ret.has_value()) { + logger.info("SCHED: New user rnti=0x%x, cc=%d", rnti, cfg.cells[0].cc); + } else { + logger.error("SCHED: Failed to create new user rnti=0x%x", rnti); + } } else { ue_db[rnti]->set_cfg(uecfg); } diff --git a/srsenb/src/stack/mac/nr/sched_nr_ue.cc b/srsenb/src/stack/mac/nr/sched_nr_ue.cc index f14388166..a0bb2177b 100644 --- a/srsenb/src/stack/mac/nr/sched_nr_ue.cc +++ b/srsenb/src/stack/mac/nr/sched_nr_ue.cc @@ -140,12 +140,7 @@ slot_ue ue::try_reserve(slot_point pdcch_slot, uint32_t cc) return slot_ue(); } - slot_ue sfu = carriers[cc]->try_reserve(pdcch_slot, cfg(), dl_pending_bytes, ul_pending_bytes); - if (sfu.empty()) { - return slot_ue(); - } - - return sfu; + return carriers[cc]->try_reserve(pdcch_slot, cfg(), dl_pending_bytes, ul_pending_bytes); } } // namespace sched_nr_impl diff --git a/srsenb/src/stack/mac/nr/sched_nr_worker.cc b/srsenb/src/stack/mac/nr/sched_nr_worker.cc index f0c682c16..954cc59f2 100644 --- a/srsenb/src/stack/mac/nr/sched_nr_worker.cc +++ b/srsenb/src/stack/mac/nr/sched_nr_worker.cc @@ -147,20 +147,21 @@ void sched_worker_manager::enqueue_cc_event(uint32_t cc, srsran::move_callbackhas_ca() == update_ca_users) { + if ((locked_context and not ue_db.contains(ev.rnti)) or + (ue_db.contains(ev.rnti) and ue_db[ev.rnti]->has_ca() == locked_context)) { ev.callback(); } } // prepare UEs internal state for new slot for (auto& u : ue_db) { - if (u.second->has_ca() == update_ca_users) { + if (u.second->has_ca() == locked_context) { u.second->new_slot(slot_tx); } }