|
|
|
@ -329,15 +329,17 @@ alloc_result bwp_slot_allocator::alloc_pdsch(slot_ue& ue, uint32_t ss_id, const
|
|
|
|
|
// Allocate HARQ
|
|
|
|
|
int mcs = ue->fixed_pdsch_mcs();
|
|
|
|
|
if (ue.h_dl->empty()) {
|
|
|
|
|
mcs = srsran_ra_nr_cqi_to_mcs(/* cqi */ ue.dl_cqi(),
|
|
|
|
|
/* cqi_table_idx */ ue.cfg().phy().csi.reports->cqi_table,
|
|
|
|
|
/* mcs_table */ pdsch.sch.sch_cfg.mcs_table,
|
|
|
|
|
/* dci_format */ pdcch.dci.ctx.format,
|
|
|
|
|
/* search_space_type*/ pdcch.dci.ctx.ss_type,
|
|
|
|
|
/* rnti_type */ rnti_type);
|
|
|
|
|
if (mcs < 0) {
|
|
|
|
|
logger.warning("SCHED: UE rnti=0x%x reported CQI=0 - Using lowest MCS=0", ue->rnti);
|
|
|
|
|
mcs = 0;
|
|
|
|
|
mcs = srsran_ra_nr_cqi_to_mcs(/* cqi */ ue.dl_cqi(),
|
|
|
|
|
/* cqi_table_idx */ ue.cfg().phy().csi.reports->cqi_table,
|
|
|
|
|
/* mcs_table */ pdsch.sch.sch_cfg.mcs_table,
|
|
|
|
|
/* dci_format */ pdcch.dci.ctx.format,
|
|
|
|
|
/* search_space_type*/ pdcch.dci.ctx.ss_type,
|
|
|
|
|
/* rnti_type */ rnti_type);
|
|
|
|
|
if (mcs < 0) {
|
|
|
|
|
logger.warning("SCHED: UE rnti=0x%x reported CQI=0 - Using lowest MCS=0", ue->rnti);
|
|
|
|
|
mcs = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
bool success = ue.h_dl->new_tx(ue.pdsch_slot, ue.uci_slot, dl_grant, mcs, 4, pdcch.dci);
|
|
|
|
|
srsran_assert(success, "Failed to allocate DL HARQ");
|
|
|
|
@ -351,6 +353,7 @@ alloc_result bwp_slot_allocator::alloc_pdsch(slot_ue& ue, uint32_t ss_id, const
|
|
|
|
|
slot_cfg.idx = ue.pdsch_slot.to_uint();
|
|
|
|
|
// Value 0.95 is from TS 38.214 v15.14.00, Section 5.1.3, page 17
|
|
|
|
|
const static float max_R = 0.95;
|
|
|
|
|
double R_prime = max_R;
|
|
|
|
|
while (true) {
|
|
|
|
|
// Generate PDSCH
|
|
|
|
|
bool success = ue->phy().get_pdsch_cfg(slot_cfg, pdcch.dci, pdsch.sch);
|
|
|
|
@ -358,14 +361,15 @@ 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 pdsch.sch.grant.tb[0].R_prime < max_R or mcs <= 0) {
|
|
|
|
|
R_prime = pdsch.sch.grant.tb[0].R_prime;
|
|
|
|
|
if (ue.h_dl->nof_retx() > 0 or R_prime < max_R or mcs <= 0) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// Decrease MCS if first tx and rate is too high
|
|
|
|
|
mcs--;
|
|
|
|
|
pdcch.dci.mcs = mcs;
|
|
|
|
|
}
|
|
|
|
|
if (mcs == 0) {
|
|
|
|
|
if (R_prime >= max_R and mcs == 0) {
|
|
|
|
|
logger.warning("Couldn't find mcs that leads to R<0.95");
|
|
|
|
|
}
|
|
|
|
|
ue.h_dl->set_mcs(mcs);
|
|
|
|
|