sched: fix ul max coderate derivation

master
Francisco Paisana 3 years ago
parent c9183326ce
commit 1f118aa238

@ -94,7 +94,9 @@ tbs_info compute_mcs_and_tbs(uint32_t nof_prb,
assert((is_ul or not ulqam64_enabled) && "DL cannot use UL-QAM64 enable flag");
uint32_t max_Qm = (is_ul) ? (ulqam64_enabled ? 6 : 4) : (use_tbs_index_alt ? 8 : 6);
if (!is_ul) {
max_coderate = std::min(max_coderate, 0.930F * max_Qm);
}
int mcs = 0;
do {
@ -123,7 +125,9 @@ tbs_info compute_mcs_and_tbs(uint32_t nof_prb,
// update max coderate based on mcs
srsran_mod_t mod = (is_ul) ? srsran_ra_ul_mod_from_mcs(mcs) : srsran_ra_dl_mod_from_mcs(mcs, use_tbs_index_alt);
uint32_t Qm = srsran_mod_bits_x_symbol(mod);
if (!is_ul) {
max_coderate = std::min(0.930F * Qm, max_coderate);
}
if (coderate <= max_coderate) {
// solution was found
@ -151,7 +155,7 @@ tbs_info compute_min_mcs_and_tbs_from_required_bytes(uint32_t nof_prb,
{
// get max MCS/TBS that meets max coderate requirements
tbs_info tb_max = compute_mcs_and_tbs(nof_prb, nof_re, cqi, max_mcs, is_ul, ulqam64_enabled, use_tbs_index_alt);
if (tb_max.tbs_bytes + 8 <= (int)req_bytes or tb_max.mcs == 0) {
if (tb_max.tbs_bytes + 8 <= (int)req_bytes or tb_max.mcs == 0 or req_bytes <= 0) {
// if mcs cannot be lowered or a decrease in TBS index won't meet req_bytes requirement
return tb_max;
}

@ -271,6 +271,43 @@ int test_min_mcs_tbs_specific()
return SRSRAN_SUCCESS;
}
void test_ul_mcs_tbs_derivation()
{
uint32_t cqi = 15;
uint32_t max_mcs = 28;
sched_cell_params_t cell_params;
prbmask_t prbs;
auto compute_tbs_mcs = [&prbs, &cell_params, &max_mcs, &cqi](uint32_t Nprb, uint32_t prb_grant_size) {
sched_interface::cell_cfg_t cell_cfg = generate_default_cell_cfg(Nprb);
sched_interface::sched_args_t sched_args = {};
cell_params.set_cfg(0, cell_cfg, sched_args);
prbs.resize(Nprb);
prbs.fill(2, prb_grant_size);
uint32_t req_bytes = 1000000;
uint32_t N_srs = 0;
uint32_t nof_symb = 2 * (SRSRAN_CP_NSYMB(cell_params.cfg.cell.cp) - 1) - N_srs;
uint32_t nof_re = nof_symb * prbs.count() * SRSRAN_NRE;
return compute_min_mcs_and_tbs_from_required_bytes(
prbs.count(), nof_re, cqi, max_mcs, req_bytes, true, false, false);
};
cqi = 0;
TESTASSERT(compute_tbs_mcs(25, 25 - 4).mcs == 0);
TESTASSERT(compute_tbs_mcs(50, 50 - 5).mcs == 0);
cqi = 5;
TESTASSERT(compute_tbs_mcs(25, 25 - 4).mcs == 9);
TESTASSERT(compute_tbs_mcs(50, 50 - 5).mcs == 9);
cqi = 15;
TESTASSERT(compute_tbs_mcs(25, 25 - 4).mcs == 28);
TESTASSERT(compute_tbs_mcs(50, 50 - 5).mcs == 28);
TESTASSERT(compute_tbs_mcs(75, 75 - 5).mcs == 28);
TESTASSERT(compute_tbs_mcs(100, 100 - 5).mcs == 28);
}
} // namespace srsenb
int main()
@ -286,6 +323,7 @@ int main()
TESTASSERT(srsenb::test_mcs_lookup_specific() == SRSRAN_SUCCESS);
TESTASSERT(srsenb::test_mcs_tbs_consistency_all() == SRSRAN_SUCCESS);
TESTASSERT(srsenb::test_min_mcs_tbs_specific() == SRSRAN_SUCCESS);
srsenb::test_ul_mcs_tbs_derivation();
printf("Success\n");
return 0;

Loading…
Cancel
Save