From 4cb6ed27ebc236d5feb03e4ef921e4560c25daac Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Tue, 20 Oct 2020 16:14:15 +0100 Subject: [PATCH] updated scheduler ue mcs computation to account for new 256QAM tables --- lib/include/srslte/phy/phch/cqi.h | 2 +- lib/src/phy/phch/cqi.c | 24 +++++++++++++++++++++--- srsenb/src/stack/mac/scheduler_ue.cc | 8 ++++---- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/lib/include/srslte/phy/phch/cqi.h b/lib/include/srslte/phy/phch/cqi.h index 3fc970cb1..d003ba783 100644 --- a/lib/include/srslte/phy/phch/cqi.h +++ b/lib/include/srslte/phy/phch/cqi.h @@ -161,6 +161,6 @@ SRSLTE_API int srslte_cqi_hl_get_no_subbands(int nof_prb); SRSLTE_API uint8_t srslte_cqi_from_snr(float snr); -SRSLTE_API float srslte_cqi_to_coderate(uint32_t cqi); +SRSLTE_API float srslte_cqi_to_coderate(uint32_t cqi, bool use_alt_table); #endif // SRSLTE_CQI_H diff --git a/lib/src/phy/phch/cqi.c b/lib/src/phy/phch/cqi.c index 72662caea..b0124562d 100644 --- a/lib/src/phy/phch/cqi.c +++ b/lib/src/phy/phch/cqi.c @@ -537,7 +537,7 @@ bool srslte_cqi_periodic_send(const srslte_cqi_report_cfg_t* cfg, uint32_t tti, return cfg->periodic_configured && cqi_send(cfg->pmi_idx, tti, frame_type == SRSLTE_FDD); } -// CQI-to-Spectral Efficiency: 36.213 Table 7.2.3-1 */ +// CQI-to-Spectral Efficiency: 36.213 Table 7.2.3-1 static float cqi_to_coderate[16] = {0, 0.1523, 0.2344, @@ -555,10 +555,28 @@ static float cqi_to_coderate[16] = {0, 5.1152, 5.5547}; -float srslte_cqi_to_coderate(uint32_t cqi) +// CQI-to-Spectral Efficiency: 36.213 Table 7.2.3-2 +static float cqi_to_coderate_table2[16] = {0, + 0.1523, + 0.3770, + 0.8770, + 1.4766, + 1.9141, + 2.4063, + 2.7305, + 3.3223, + 3.9023, + 4.5234, + 5.1152, + 5.5547, + 6.2266, + 6.9141, + 7.4063}; + +float srslte_cqi_to_coderate(uint32_t cqi, bool use_alt_table) { if (cqi < 16) { - return cqi_to_coderate[cqi]; + return use_alt_table ? cqi_to_coderate_table2[cqi] : cqi_to_coderate[cqi]; } else { return 0; } diff --git a/srsenb/src/stack/mac/scheduler_ue.cc b/srsenb/src/stack/mac/scheduler_ue.cc index b0a1987e7..1af6ed86d 100644 --- a/srsenb/src/stack/mac/scheduler_ue.cc +++ b/srsenb/src/stack/mac/scheduler_ue.cc @@ -1208,10 +1208,10 @@ int cc_sched_ue::cqi_to_tbs(uint32_t nof_prb, uint32_t nof_re, bool use_tbs_inde uint32_t cqi = is_ul ? ul_cqi : dl_cqi; uint32_t max_mcs = is_ul ? max_mcs_ul : (cfg->use_tbs_index_alt) ? max_mcs_dl_alt : max_mcs_dl; - uint32_t max_Qm = is_ul and not ul_64qam_enabled ? 4 : 6; //< TODO: Allow PUSCH 64QAM + uint32_t max_Qm = is_ul and not ul_64qam_enabled ? 4 : (not is_ul and use_tbs_index_alt ? 8 : 6); // Take the upper bound code-rate - float max_coderate = srslte_cqi_to_coderate(cqi < 15 ? cqi + 1 : 15); + float max_coderate = srslte_cqi_to_coderate(std::min(cqi + 1u, 15u), use_tbs_index_alt); int sel_mcs = max_mcs + 1; float coderate = 99; int tbs = 0; @@ -1345,7 +1345,7 @@ void cc_sched_ue::finish_tti(srslte::tti_point tti_rx) uint32_t cc_sched_ue::get_aggr_level(uint32_t nof_bits) { uint32_t l = 0; - float max_coderate = srslte_cqi_to_coderate(dl_cqi); + float max_coderate = srslte_cqi_to_coderate(dl_cqi, cfg->use_tbs_index_alt); float coderate = 99; float factor = 1.5; uint32_t l_max = 3; @@ -1382,7 +1382,7 @@ int cc_sched_ue::alloc_tbs(uint32_t nof_prb, uint32_t nof_re, uint32_t req_bytes int req_tbs_idx = srslte_ra_tbs_to_table_idx(req_bytes * 8, nof_prb); int req_mcs = srslte_ra_mcs_from_tbs_idx(req_tbs_idx, cfg->use_tbs_index_alt, is_ul); - if (req_mcs < (int)sel_mcs) { + if (req_mcs >= 0 and req_mcs < (int)sel_mcs) { sel_mcs = req_mcs; tbs_bytes = srslte_ra_tbs_from_idx(req_tbs_idx, nof_prb) / 8; }