From 6bec92fbc9a0d337f2e214080b6e8055fe671189 Mon Sep 17 00:00:00 2001 From: Francisco Date: Thu, 18 Mar 2021 22:25:35 +0000 Subject: [PATCH] using new DFS-based PDCCH allocator as a default --- srsenb/hdr/stack/mac/sched_grid.h | 24 ++++---- srsenb/src/stack/mac/sched_grid.cc | 14 ++--- .../mac/sched_phy_ch/sf_cch_allocator.cc | 58 ++++++++++--------- srsenb/test/mac/sched_benchmark.cc | 12 ++-- 4 files changed, 57 insertions(+), 51 deletions(-) diff --git a/srsenb/hdr/stack/mac/sched_grid.h b/srsenb/hdr/stack/mac/sched_grid.h index 2e55ef2c1..86d9b1b9b 100644 --- a/srsenb/hdr/stack/mac/sched_grid.h +++ b/srsenb/hdr/stack/mac/sched_grid.h @@ -106,11 +106,11 @@ public: bool find_ul_alloc(uint32_t L, prb_interval* alloc) const; // getters - const rbgmask_t& get_dl_mask() const { return dl_mask; } - const prbmask_t& get_ul_mask() const { return ul_mask; } - uint32_t get_cfi() const { return pdcch_alloc.get_cfi(); } - const sf_cch_allocator& get_pdcch_grid() const { return pdcch_alloc; } - uint32_t get_pucch_width() const { return pucch_nrb; } + const rbgmask_t& get_dl_mask() const { return dl_mask; } + const prbmask_t& get_ul_mask() const { return ul_mask; } + uint32_t get_cfi() const { return pdcch_alloc.get_cfi(); } + const sf_cch_allocator2& get_pdcch_grid() const { return pdcch_alloc; } + uint32_t get_pucch_width() const { return pucch_nrb; } private: alloc_result alloc_dl(uint32_t aggr_lvl, @@ -127,7 +127,7 @@ private: prbmask_t pucch_mask; // derived - sf_cch_allocator pdcch_alloc = {}; + sf_cch_allocator2 pdcch_alloc = {}; // internal state tti_point tti_rx; @@ -219,12 +219,12 @@ public: const sched_cell_params_t* get_cc_cfg() const { return cc_cfg; } private: - void set_dl_data_sched_result(const sf_cch_allocator::alloc_result_t& dci_result, - sched_interface::dl_sched_res_t* dl_result, - sched_ue_list& ue_list); - void set_ul_sched_result(const sf_cch_allocator::alloc_result_t& dci_result, - sched_interface::ul_sched_res_t* ul_result, - sched_ue_list& ue_list); + void set_dl_data_sched_result(const sf_cch_allocator2::alloc_result_t& dci_result, + sched_interface::dl_sched_res_t* dl_result, + sched_ue_list& ue_list); + void set_ul_sched_result(const sf_cch_allocator2::alloc_result_t& dci_result, + sched_interface::ul_sched_res_t* ul_result, + sched_ue_list& ue_list); // consts const sched_cell_params_t* cc_cfg = nullptr; diff --git a/srsenb/src/stack/mac/sched_grid.cc b/srsenb/src/stack/mac/sched_grid.cc index d4d983c60..22afd988e 100644 --- a/srsenb/src/stack/mac/sched_grid.cc +++ b/srsenb/src/stack/mac/sched_grid.cc @@ -645,9 +645,9 @@ alloc_result sf_sched::alloc_phich(sched_ue* user) return alloc_result::no_rnti_opportunity; } -void sf_sched::set_dl_data_sched_result(const sf_cch_allocator::alloc_result_t& dci_result, - sched_interface::dl_sched_res_t* dl_result, - sched_ue_list& ue_list) +void sf_sched::set_dl_data_sched_result(const sf_cch_allocator2::alloc_result_t& dci_result, + sched_interface::dl_sched_res_t* dl_result, + sched_ue_list& ue_list) { for (const auto& data_alloc : data_allocs) { dl_result->data.emplace_back(); @@ -788,9 +788,9 @@ uci_pusch_t is_uci_included(const sf_sched* sf_sched, } } -void sf_sched::set_ul_sched_result(const sf_cch_allocator::alloc_result_t& dci_result, - sched_interface::ul_sched_res_t* ul_result, - sched_ue_list& ue_list) +void sf_sched::set_ul_sched_result(const sf_cch_allocator2::alloc_result_t& dci_result, + sched_interface::ul_sched_res_t* ul_result, + sched_ue_list& ue_list) { /* Set UL data DCI locs and format */ for (const auto& ul_alloc : ul_data_allocs) { @@ -902,7 +902,7 @@ void sf_sched::generate_sched_results(sched_ue_list& ue_db) } /* Pick one of the possible DCI masks */ - sf_cch_allocator::alloc_result_t dci_result; + sf_cch_allocator2::alloc_result_t dci_result; // tti_alloc.get_pdcch_grid().result_to_string(); tti_alloc.get_pdcch_grid().get_allocs(&dci_result, &cc_result->pdcch_mask); diff --git a/srsenb/src/stack/mac/sched_phy_ch/sf_cch_allocator.cc b/srsenb/src/stack/mac/sched_phy_ch/sf_cch_allocator.cc index 32a7c9c4d..8148da106 100644 --- a/srsenb/src/stack/mac/sched_phy_ch/sf_cch_allocator.cc +++ b/srsenb/src/stack/mac/sched_phy_ch/sf_cch_allocator.cc @@ -78,6 +78,11 @@ bool sf_cch_allocator2::alloc_dci(alloc_type_t alloc_type, uint32_t aggr_idx, sc if (success) { // DCI record allocation successful dci_record_list.push_back(record); + + if (is_dl_ctrl_alloc(alloc_type)) { + // Dynamic CFI not yet supported for DL control allocations, as coderate can be exceeded + current_max_cfix = current_cfix; + } return true; } if (temp_dci_dfs.empty()) { @@ -91,30 +96,6 @@ bool sf_cch_allocator2::alloc_dci(alloc_type_t alloc_type, uint32_t aggr_idx, sc return false; } -// bool sf_cch_allocator2::get_next_dfs() -//{ -// if (last_dci_dfs.empty()) { -// // If we reach root, increase CFI -// if (current_cfix < cc_cfg->sched_cfg->max_nof_ctrl_symbols - 1) { -// current_cfix++; -// return true; -// } -// return false; -// } -// -// uint32_t dfs_level = last_dci_dfs.size() - 1; -// uint32_t start_child_idx = last_dci_dfs.back().dci_pos_idx + 1; -// last_dci_dfs.pop_back(); -// while (not alloc_dfs_node(dci_record_list[dfs_level], start_child_idx)) { -// start_child_idx = 0; -// // If failed to allocate record, go one level lower in DFS -// if (not get_next_dfs()) { -// // If no more options in DFS, return false -// return false; -// } -// } -//} - bool sf_cch_allocator2::get_next_dfs() { do { @@ -122,7 +103,7 @@ bool sf_cch_allocator2::get_next_dfs() if (last_dci_dfs.empty()) { // If we reach root, increase CFI current_cfix++; - if (current_cfix > cc_cfg->sched_cfg->max_nof_ctrl_symbols - 1) { + if (current_cfix > current_max_cfix) { return false; } } else { @@ -236,7 +217,32 @@ void sf_cch_allocator2::get_allocs(alloc_result_t* vec, pdcch_mask_t* tot_mask, std::string sf_cch_allocator2::result_to_string(bool verbose) const { - return ""; + fmt::basic_memory_buffer strbuf; + if (dci_record_list.empty()) { + fmt::format_to(strbuf, "SCHED: PDCCH allocations cfi={}, nof_cce={}, No allocations.\n", get_cfi(), nof_cces()); + } else { + fmt::format_to(strbuf, + "SCHED: PDCCH allocations cfi={}, nof_cce={}, nof_allocs={}, total PDCCH mask=0x{:x}", + get_cfi(), + nof_cces(), + nof_allocs(), + last_dci_dfs.back().total_mask); + alloc_result_t vec; + get_allocs(&vec); + if (verbose) { + fmt::format_to(strbuf, ", allocations:\n"); + for (const auto& dci_alloc : vec) { + fmt::format_to(strbuf, + " > rnti=0x{:0x}: 0x{:x} / 0x{:x}\n", + dci_alloc->rnti, + dci_alloc->current_mask, + dci_alloc->total_mask); + } + } else { + fmt::format_to(strbuf, ".\n"); + } + } + return fmt::to_string(strbuf); } ///////////////////////// diff --git a/srsenb/test/mac/sched_benchmark.cc b/srsenb/test/mac/sched_benchmark.cc index 2a83a41eb..d61b270c4 100644 --- a/srsenb/test/mac/sched_benchmark.cc +++ b/srsenb/test/mac/sched_benchmark.cc @@ -219,7 +219,7 @@ run_data expected_run_result(run_params params) int tbs = srslte_ra_tbs_from_idx(tbs_idx, params.nof_prbs); ret.avg_dl_throughput = static_cast(tbs) * 1e3F; // bps - tbs_idx = srslte_ra_tbs_idx_from_mcs(28, false, true); + tbs_idx = srslte_ra_tbs_idx_from_mcs(24, false, true); uint32_t nof_pusch_prbs = params.nof_prbs - (params.nof_prbs == 6 ? 2 : 4); tbs = srslte_ra_tbs_from_idx(tbs_idx, nof_pusch_prbs); ret.avg_ul_throughput = static_cast(tbs) * 1e3F; // bps @@ -229,16 +229,16 @@ run_data expected_run_result(run_params params) switch (params.nof_prbs) { case 6: ret.avg_dl_mcs = 25; - ret.avg_dl_throughput *= 0.7; - ret.avg_ul_throughput *= 0.25; + ret.avg_dl_throughput *= 0.68; + ret.avg_ul_throughput *= 0.75; break; case 15: ret.avg_dl_throughput *= 0.95; - ret.avg_ul_throughput *= 0.5; + ret.avg_ul_throughput *= 0.7; break; default: ret.avg_dl_throughput *= 0.97; - ret.avg_ul_throughput *= 0.5; + ret.avg_ul_throughput *= 0.85; break; } return ret; @@ -257,7 +257,7 @@ void print_benchmark_results(const std::vector& run_results) int tbs_idx = srslte_ra_tbs_idx_from_mcs(28, false, false); int tbs = srslte_ra_tbs_from_idx(tbs_idx, r.params.nof_prbs); float dl_rate_overhead = 1.0F - r.avg_dl_throughput / (static_cast(tbs) * 1e3F); - tbs_idx = srslte_ra_tbs_idx_from_mcs(28, false, true); + tbs_idx = srslte_ra_tbs_idx_from_mcs(24, false, true); uint32_t nof_pusch_prbs = r.params.nof_prbs - (r.params.nof_prbs == 6 ? 2 : 4); tbs = srslte_ra_tbs_from_idx(tbs_idx, nof_pusch_prbs); float ul_rate_overhead = 1.0F - r.avg_ul_throughput / (static_cast(tbs) * 1e3F);