From d927b779dc2220ee3acb969dc3ff9265529e14a0 Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Tue, 28 Sep 2021 11:57:45 +0200 Subject: [PATCH] sched,nr: implement methods to fill nzp csi-rs in scheduler --- srsenb/hdr/stack/mac/nr/sched_nr_cfg.h | 8 ++- .../stack/mac/nr/sched_nr_grant_allocator.h | 4 +- srsenb/hdr/stack/mac/nr/sched_nr_signalling.h | 36 ++++++++++++ srsenb/src/stack/mac/nr/CMakeLists.txt | 3 +- .../src/stack/mac/nr/sched_nr_signalling.cc | 55 +++++++++++++++++++ srsenb/src/stack/mac/nr/sched_nr_worker.cc | 7 +++ 6 files changed, 109 insertions(+), 4 deletions(-) create mode 100644 srsenb/hdr/stack/mac/nr/sched_nr_signalling.h create mode 100644 srsenb/src/stack/mac/nr/sched_nr_signalling.cc diff --git a/srsenb/hdr/stack/mac/nr/sched_nr_cfg.h b/srsenb/hdr/stack/mac/nr/sched_nr_cfg.h index 210e34921..0839b523e 100644 --- a/srsenb/hdr/stack/mac/nr/sched_nr_cfg.h +++ b/srsenb/hdr/stack/mac/nr/sched_nr_cfg.h @@ -30,12 +30,16 @@ const static size_t MAX_GRANTS = sched_nr_interface::MAX_GRANTS; using pdcch_dl_t = mac_interface_phy_nr::pdcch_dl_t; using pdcch_ul_t = mac_interface_phy_nr::pdcch_ul_t; +using pdsch_t = mac_interface_phy_nr::pdsch_t; +using pusch_t = mac_interface_phy_nr::pusch_t; +using pucch_t = mac_interface_phy_nr::pucch_t; using pdcch_dl_list_t = srsran::bounded_vector; using pdcch_ul_list_t = srsran::bounded_vector; -using pucch_t = mac_interface_phy_nr::pucch_t; using pucch_list_t = srsran::bounded_vector; -using pusch_t = mac_interface_phy_nr::pusch_t; using pusch_list_t = srsran::bounded_vector; +using nzp_csi_rs_list = srsran::bounded_vector; +using ssb_t = mac_interface_phy_nr::ssb_t; +using ssb_list = srsran::bounded_vector; using sched_cfg_t = sched_nr_interface::sched_cfg_t; using cell_cfg_t = sched_nr_interface::cell_cfg_t; diff --git a/srsenb/hdr/stack/mac/nr/sched_nr_grant_allocator.h b/srsenb/hdr/stack/mac/nr/sched_nr_grant_allocator.h index a306fc5a6..9f49a22bd 100644 --- a/srsenb/hdr/stack/mac/nr/sched_nr_grant_allocator.h +++ b/srsenb/hdr/stack/mac/nr/sched_nr_grant_allocator.h @@ -23,6 +23,7 @@ namespace srsenb { namespace sched_nr_impl { +// typedefs using dl_sched_rar_info_t = sched_nr_interface::dl_sched_rar_info_t; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -30,7 +31,6 @@ using dl_sched_rar_info_t = sched_nr_interface::dl_sched_rar_info_t; const static size_t MAX_CORESET_PER_BWP = 3; using slot_coreset_list = std::array, MAX_CORESET_PER_BWP>; -using pdsch_t = mac_interface_phy_nr::pdsch_t; using pdsch_list_t = srsran::bounded_vector; using sched_rar_list_t = sched_nr_interface::sched_rar_list_t; using pucch_list_t = srsran::bounded_vector; @@ -47,6 +47,8 @@ struct bwp_slot_grid { bwp_rb_bitmap dl_prbs; bwp_rb_bitmap ul_prbs; + ssb_list ssb; + nzp_csi_rs_list nzp_csi_rs; pdcch_dl_list_t dl_pdcchs; pdcch_ul_list_t ul_pdcchs; pdsch_list_t pdschs; diff --git a/srsenb/hdr/stack/mac/nr/sched_nr_signalling.h b/srsenb/hdr/stack/mac/nr/sched_nr_signalling.h new file mode 100644 index 000000000..e7bc59f96 --- /dev/null +++ b/srsenb/hdr/stack/mac/nr/sched_nr_signalling.h @@ -0,0 +1,36 @@ +/** + * + * \section COPYRIGHT + * + * Copyright 2013-2021 Software Radio Systems Limited + * + * By using this file, you agree to the terms and conditions set + * forth in the LICENSE file which can be found at the top level of + * the distribution. + * + */ + +#ifndef SRSRAN_SCHED_NR_SIGNALLING_H +#define SRSRAN_SCHED_NR_SIGNALLING_H + +#include "sched_nr_cfg.h" +#include "sched_nr_interface.h" + +namespace srsenb { +namespace sched_nr_impl { + +/// Schedule NZP-CSI-RS resources for given slot +void sched_nzp_csi_rs(srsran::const_span nzp_csi_rs_sets, + const srsran_slot_cfg_t& slot_cfg, + nzp_csi_rs_list& csi_rs_list); + +/// For a given BWP and slot, schedule SSB, NZP CSI RS and SIBs +void sched_dl_signalling(const bwp_params& bwp_params, + slot_point sl_pdcch, + ssb_list& ssb_list, + nzp_csi_rs_list& nzp_csi_rs); + +} // namespace sched_nr_impl +} // namespace srsenb + +#endif // SRSRAN_SCHED_NR_SIGNALLING_H diff --git a/srsenb/src/stack/mac/nr/CMakeLists.txt b/srsenb/src/stack/mac/nr/CMakeLists.txt index 51e8d57eb..4e7c859ef 100644 --- a/srsenb/src/stack/mac/nr/CMakeLists.txt +++ b/srsenb/src/stack/mac/nr/CMakeLists.txt @@ -19,7 +19,8 @@ set(SOURCES mac_nr.cc sched_nr_cell.cc sched_nr_rb.cc sched_nr_time_rr.cc - harq_softbuffer.cc) + harq_softbuffer.cc + sched_nr_signalling.cc) add_library(srsgnb_mac STATIC ${SOURCES}) target_link_libraries(srsgnb_mac srsenb_mac_common) diff --git a/srsenb/src/stack/mac/nr/sched_nr_signalling.cc b/srsenb/src/stack/mac/nr/sched_nr_signalling.cc new file mode 100644 index 000000000..f7c0e9b9e --- /dev/null +++ b/srsenb/src/stack/mac/nr/sched_nr_signalling.cc @@ -0,0 +1,55 @@ +/** + * + * \section COPYRIGHT + * + * Copyright 2013-2021 Software Radio Systems Limited + * + * By using this file, you agree to the terms and conditions set + * forth in the LICENSE file which can be found at the top level of + * the distribution. + * + */ + +#include "srsenb/hdr/stack/mac/nr/sched_nr_signalling.h" + +namespace srsenb { +namespace sched_nr_impl { + +void sched_nzp_csi_rs(srsran::const_span nzp_csi_rs_sets_cfg, + const srsran_slot_cfg_t& slot_cfg, + nzp_csi_rs_list& csi_rs_list) +{ + for (const srsran_csi_rs_nzp_set_t& set : nzp_csi_rs_sets_cfg) { + // For each NZP-CSI-RS resource available in the set + for (uint32_t i = 0; i < set.count; ++i) { + // Select resource + const srsran_csi_rs_nzp_resource_t& nzp_csi_resource = set.data[i]; + + // Check if the resource is scheduled for this slot + if (srsran_csi_rs_send(&nzp_csi_resource.periodicity, &slot_cfg)) { + csi_rs_list.push_back(nzp_csi_resource); + } + } + } +} + +void sched_dl_signalling(const bwp_params& bwp_params, + slot_point sl_pdcch, + ssb_list& ssb_list, + nzp_csi_rs_list& nzp_csi_rs) +{ + srsran_slot_cfg_t cfg; + cfg.idx = sl_pdcch.to_uint(); + + // Schedule SSB + // TODO + + // Schedule NZP-CSI-RS + sched_nzp_csi_rs(bwp_params.cfg.pdsch.nzp_csi_rs_sets, cfg, nzp_csi_rs); + + // Schedule SIBs + // TODO +} + +} // namespace sched_nr_impl +} // namespace srsenb diff --git a/srsenb/src/stack/mac/nr/sched_nr_worker.cc b/srsenb/src/stack/mac/nr/sched_nr_worker.cc index 57b1d40ad..f003d1783 100644 --- a/srsenb/src/stack/mac/nr/sched_nr_worker.cc +++ b/srsenb/src/stack/mac/nr/sched_nr_worker.cc @@ -11,6 +11,7 @@ */ #include "srsenb/hdr/stack/mac/nr/sched_nr_worker.h" +#include "srsenb/hdr/stack/mac/nr/sched_nr_signalling.h" #include "srsran/common/string_helpers.h" namespace srsenb { @@ -255,6 +256,12 @@ void sched_worker_manager::update_ue_db(slot_point slot_tx, bool locked_context) void sched_worker_manager::run_slot(slot_point slot_tx, uint32_t cc, dl_sched_res_t& dl_res, ul_sched_t& ul_res) { + // Fill DL signalling messages that do not depend on UEs state + serv_cell_manager& serv_cell = *cells[cc]; + bwp_slot_grid& bwp_slot = serv_cell.bwps[0].grid[slot_tx]; + sched_dl_signalling(*serv_cell.bwps[0].cfg, slot_tx, bwp_slot.ssb, bwp_slot.nzp_csi_rs); + + // Synchronization point between CC workers, to avoid concurrency in UE state access srsran::bounded_vector waiting_cvars; { std::unique_lock lock(slot_mutex);