From 486dd9099c02275ae1f2c6ed02efee793e8c80ff Mon Sep 17 00:00:00 2001 From: Francisco Date: Mon, 13 Dec 2021 18:12:32 +0000 Subject: [PATCH] nr,gnb,sched: fix crash in mcs selection loop --- srsgnb/src/stack/mac/sched_nr_grant_allocator.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/srsgnb/src/stack/mac/sched_nr_grant_allocator.cc b/srsgnb/src/stack/mac/sched_nr_grant_allocator.cc index 60a1ab451..0bea82f28 100644 --- a/srsgnb/src/stack/mac/sched_nr_grant_allocator.cc +++ b/srsgnb/src/stack/mac/sched_nr_grant_allocator.cc @@ -347,16 +347,17 @@ alloc_result bwp_slot_allocator::alloc_pdsch(slot_ue& ue, uint32_t ss_id, const if (ue.h_dl->nof_retx() != 0) { srsran_assert(pdsch.sch.grant.tb[0].tbs == (int)ue.h_dl->tbs(), "The TBS did not remain constant in retx"); } - if (ue.h_dl->nof_retx() > 0 or bwp_pdsch_slot.dl.phy.pdsch.back().sch.grant.tb[0].R_prime < max_R or mcs <= 0) { + if (ue.h_dl->nof_retx() > 0 or pdsch.sch.grant.tb[0].R_prime < max_R or mcs <= 0) { break; } // Decrease MCS if first tx and rate is too high mcs--; - ue.h_dl->set_mcs(mcs); + pdcch.dci.mcs = mcs; } if (mcs == 0) { logger.warning("Couldn't find mcs that leads to R<0.95"); } + ue.h_dl->set_mcs(mcs); ue.h_dl->set_tbs(pdsch.sch.grant.tb[0].tbs); // set HARQ TBS pdsch.sch.grant.tb[0].softbuffer.tx = ue.h_dl->get_softbuffer().get(); pdsch.data[0] = ue.h_dl->get_tx_pdu()->get();