From 58c4bcf288825a24b101147b6009151e76863333 Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Mon, 6 Jul 2020 14:05:17 +0100 Subject: [PATCH] reduce mcs for UL grants carrying UCI --- .../srslte/interfaces/sched_interface.h | 1 + srsenb/hdr/stack/mac/scheduler_ue.h | 3 +- srsenb/src/main.cc | 1 + srsenb/src/stack/mac/scheduler_grid.cc | 29 +++++++++++++++++-- srsenb/src/stack/mac/scheduler_ue.cc | 9 +++++- 5 files changed, 39 insertions(+), 4 deletions(-) diff --git a/lib/include/srslte/interfaces/sched_interface.h b/lib/include/srslte/interfaces/sched_interface.h index bef595dde..2aca48296 100644 --- a/lib/include/srslte/interfaces/sched_interface.h +++ b/lib/include/srslte/interfaces/sched_interface.h @@ -60,6 +60,7 @@ public: uint32_t min_nof_ctrl_symbols = 1; uint32_t max_nof_ctrl_symbols = 3; int max_aggr_level = 3; + int uci_mcs_dec = 3; }; struct cell_cfg_t { diff --git a/srsenb/hdr/stack/mac/scheduler_ue.h b/srsenb/hdr/stack/mac/scheduler_ue.h index 21dbba264..b589865ce 100644 --- a/srsenb/hdr/stack/mac/scheduler_ue.h +++ b/srsenb/hdr/stack/mac/scheduler_ue.h @@ -208,7 +208,8 @@ public: ul_harq_proc::ul_alloc_t alloc, bool needs_pdcch, srslte_dci_location_t cce_range, - int explicit_mcs = -1); + int explicit_mcs = -1, + bool carriers_uci = false); srslte_dci_format_t get_dci_format(); sched_dci_cce_t* get_locations(uint32_t enb_cc_idx, uint32_t current_cfi, uint32_t sf_idx); diff --git a/srsenb/src/main.cc b/srsenb/src/main.cc index 780d3db3b..27459b910 100644 --- a/srsenb/src/main.cc +++ b/srsenb/src/main.cc @@ -136,6 +136,7 @@ void parse_args(all_args_t* args, int argc, char* argv[]) ("scheduler.max_aggr_level", bpo::value(&args->stack.mac.sched.max_aggr_level)->default_value(-1), "Optional maximum aggregation level index (l=log2(L)) ") ("scheduler.max_nof_ctrl_symbols", bpo::value(&args->stack.mac.sched.max_nof_ctrl_symbols)->default_value(3), "Number of control symbols") ("scheduler.min_nof_ctrl_symbols", bpo::value(&args->stack.mac.sched.min_nof_ctrl_symbols)->default_value(1), "Minimum number of control symbols") + ("scheduler.mcs_uci_dec", bpo::value(&args->stack.mac.sched.uci_mcs_dec)->default_value(3), "Decrement of MCS in case UL grant carries UCI.") /* Downlink Channel emulator section */ ("channel.dl.enable", bpo::value(&args->phy.dl_channel_args.enable)->default_value(false), "Enable/Disable internal Downlink channel emulator") diff --git a/srsenb/src/stack/mac/scheduler_grid.cc b/srsenb/src/stack/mac/scheduler_grid.cc index ac3870835..198fcba8b 100644 --- a/srsenb/src/stack/mac/scheduler_grid.cc +++ b/srsenb/src/stack/mac/scheduler_grid.cc @@ -1045,6 +1045,27 @@ void sf_sched::set_dl_data_sched_result(const pdcch_grid_t::alloc_result_t& dci_ } } +//! Finds eNB CC Idex that currently holds UCI +int get_enb_cc_idx_with_uci(const sf_sched_result& sf_result, const sched_ue* user) +{ + uint32_t ue_cc_idx = sf_result.enb_cc_list.size(); + int sel_enb_cc_idx = -1; + for (uint32_t enbccidx = 0; enbccidx < sf_result.enb_cc_list.size(); ++enbccidx) { + for (uint32_t j = 0; j < sf_result.enb_cc_list[enbccidx].ul_sched_result.nof_dci_elems; ++j) { + // Checks all the UL grants already allocated for the given rnti + if (sf_result.enb_cc_list[enbccidx].ul_sched_result.pusch[j].dci.rnti == user->get_rnti()) { + auto p = user->get_cell_index(enbccidx); + // If the UE CC Idx is the lowest so far + if (p.first and p.second < ue_cc_idx) { + ue_cc_idx = p.second; + sel_enb_cc_idx = enbccidx; + } + } + } + } + return sel_enb_cc_idx; +} + void sf_sched::set_ul_sched_result(const pdcch_grid_t::alloc_result_t& dci_result, sched_interface::ul_sched_res_t* ul_result) { @@ -1060,13 +1081,17 @@ void sf_sched::set_ul_sched_result(const pdcch_grid_t::alloc_result_t& dci_resul cce_range = dci_result[ul_alloc.dci_idx]->dci_pos; } - /* Set fixed mcs if specified */ + // Set fixed mcs if specified int fixed_mcs = (ul_alloc.type == ul_alloc_t::MSG3) ? ul_alloc.mcs : -1; + // If UCI is encoded in the current carrier + uint32_t uci_enb_cc_idx = get_enb_cc_idx_with_uci(*cc_results, user); + bool carries_uci = uci_enb_cc_idx == cc_cfg->enb_cc_idx; + /* Generate DCI Format1A */ uint32_t pending_data_before = user->get_pending_ul_new_data(get_tti_tx_ul()); int tbs = user->generate_format0( - pusch, get_tti_tx_ul(), cell_index, ul_alloc.alloc, ul_alloc.needs_pdcch(), cce_range, fixed_mcs); + pusch, get_tti_tx_ul(), cell_index, ul_alloc.alloc, ul_alloc.needs_pdcch(), cce_range, fixed_mcs, carries_uci); ul_harq_proc* h = user->get_ul_harq(get_tti_tx_ul(), cell_index); if (tbs <= 0) { diff --git a/srsenb/src/stack/mac/scheduler_ue.cc b/srsenb/src/stack/mac/scheduler_ue.cc index 99cf6ceec..e828974e7 100644 --- a/srsenb/src/stack/mac/scheduler_ue.cc +++ b/srsenb/src/stack/mac/scheduler_ue.cc @@ -669,7 +669,8 @@ int sched_ue::generate_format0(sched_interface::ul_sched_data_t* data, ul_harq_proc::ul_alloc_t alloc, bool needs_pdcch, srslte_dci_location_t dci_pos, - int explicit_mcs) + int explicit_mcs, + bool carries_uci) { ul_harq_proc* h = get_ul_harq(tti, cc_idx); srslte_dci_ul_t* dci = &data->dci; @@ -698,6 +699,12 @@ int sched_ue::generate_format0(sched_interface::ul_sched_data_t* data, uint32_t N_srs = 0; uint32_t nof_re = (2 * (SRSLTE_CP_NSYMB(cell.cp) - 1) - N_srs) * alloc.L * SRSLTE_NRE; tbs = carriers[cc_idx].alloc_tbs_ul(alloc.L, nof_re, req_bytes, &mcs); + + if (carries_uci) { + // Reduce MCS to fit UCI + mcs -= std::min(main_cc_params->sched_cfg->uci_mcs_dec, mcs); + tbs = srslte_ra_tbs_from_idx(srslte_ra_tbs_idx_from_mcs(mcs, false, true), alloc.L) / 8; + } } h->new_tx(tti, mcs, tbs, alloc, nof_retx);