sched,nr: force R<0.9 by reducing mcs

master
Francisco 3 years ago committed by Francisco Paisana
parent d6a3daff8a
commit 7d4a5238f6

@ -58,7 +58,7 @@ public:
bool new_retx(slot_point slot_tx, slot_point slot_ack); bool new_retx(slot_point slot_tx, slot_point slot_ack);
// NOTE: Has to be used before first tx is dispatched // NOTE: Has to be used before first tx is dispatched
bool set_tbs(uint32_t tbs); bool set_tbs(uint32_t tbs, int mcs = -1);
const uint32_t pid; const uint32_t pid;

@ -243,36 +243,51 @@ alloc_result bwp_slot_allocator::alloc_pdsch(slot_ue& ue, const prb_grant& dl_gr
// Allocation Successful // Allocation Successful
// Generate PDCCH int mcs = ue.cfg->ue_cfg()->fixed_dl_mcs;
pdcch_dl_t& pdcch = bwp_pdcch_slot.dl_pdcchs.back(); do {
fill_dl_dci_ue_fields(ue, *bwp_grid.cfg, ss_id, pdcch.dci.ctx.location, pdcch.dci); // Generate PDCCH
pdcch.dci.pucch_resource = 0; pdcch_dl_t& pdcch = bwp_pdcch_slot.dl_pdcchs.back();
pdcch.dci.dai = std::count_if(bwp_uci_slot.pending_acks.begin(), fill_dl_dci_ue_fields(ue, *bwp_grid.cfg, ss_id, pdcch.dci.ctx.location, pdcch.dci);
bwp_uci_slot.pending_acks.end(), pdcch.dci.pucch_resource = 0;
[&ue](const harq_ack_t& p) { return p.res.rnti == ue.rnti; }); pdcch.dci.dai = std::count_if(bwp_uci_slot.pending_acks.begin(),
pdcch.dci.dai %= 4; bwp_uci_slot.pending_acks.end(),
pdcch.dci_cfg = ue.cfg->phy().get_dci_cfg(); [&ue](const harq_ack_t& p) { return p.res.rnti == ue.rnti; });
pdcch.dci.dai %= 4;
// Generate PUCCH pdcch.dci_cfg = ue.cfg->phy().get_dci_cfg();
bwp_uci_slot.pending_acks.emplace_back();
bwp_uci_slot.pending_acks.back().phy_cfg = &ue.cfg->phy(); // Generate PUCCH
srsran_assert(ue.cfg->phy().get_pdsch_ack_resource(pdcch.dci, bwp_uci_slot.pending_acks.back().res), bwp_uci_slot.pending_acks.emplace_back();
"Error getting ack resource"); bwp_uci_slot.pending_acks.back().phy_cfg = &ue.cfg->phy();
srsran_assert(ue.cfg->phy().get_pdsch_ack_resource(pdcch.dci, bwp_uci_slot.pending_acks.back().res),
// Generate PDSCH "Error getting ack resource");
bwp_pdsch_slot.dl_prbs |= dl_grant;
bwp_pdsch_slot.pdschs.emplace_back(); // Generate PDSCH
pdsch_t& pdsch = bwp_pdsch_slot.pdschs.back(); bwp_pdsch_slot.dl_prbs |= dl_grant;
srsran_slot_cfg_t slot_cfg; bwp_pdsch_slot.pdschs.emplace_back();
slot_cfg.idx = ue.pdsch_slot.to_uint(); pdsch_t& pdsch = bwp_pdsch_slot.pdschs.back();
bool ret = ue.cfg->phy().get_pdsch_cfg(slot_cfg, pdcch.dci, pdsch.sch); srsran_slot_cfg_t slot_cfg;
srsran_assert(ret, "Error converting DCI to grant"); slot_cfg.idx = ue.pdsch_slot.to_uint();
pdsch.sch.grant.tb[0].softbuffer.tx = ue.h_dl->get_softbuffer().get(); bool ret = ue.cfg->phy().get_pdsch_cfg(slot_cfg, pdcch.dci, pdsch.sch);
pdsch.data[0] = ue.h_dl->get_tx_pdu()->get(); srsran_assert(ret, "Error converting DCI to grant");
if (ue.h_dl->nof_retx() == 0) {
ue.h_dl->set_tbs(pdsch.sch.grant.tb[0].tbs); // update HARQ with correct TBS pdsch.sch.grant.tb[0].softbuffer.tx = ue.h_dl->get_softbuffer().get();
} else { pdsch.data[0] = ue.h_dl->get_tx_pdu()->get();
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) {
ue.h_dl->set_tbs(pdsch.sch.grant.tb[0].tbs); // update HARQ with correct TBS
} else {
srsran_assert(pdsch.sch.grant.tb[0].tbs == (int)ue.h_dl->tbs(), "The TBS did not remain constant in retx");
}
if (bwp_pdsch_slot.pdschs.back().sch.grant.tb[0].R < 0.9 or mcs == 0) {
break;
}
// Decrease MCS if rate is too high
mcs--;
ue.h_dl->set_tbs(100, mcs);
bwp_pdsch_slot.pdschs.pop_back();
bwp_uci_slot.pending_acks.pop_back();
} while (true);
if (mcs == 0) {
logger.warning("Couldn't find mcs that leads to R<0.9");
} }
return alloc_result::success; return alloc_result::success;

@ -66,12 +66,15 @@ bool harq_proc::new_tx(slot_point slot_tx_,
return true; return true;
} }
bool harq_proc::set_tbs(uint32_t tbs) bool harq_proc::set_tbs(uint32_t tbs, int mcs)
{ {
if (empty() or nof_retx() > 0) { if (empty() or nof_retx() > 0) {
return false; return false;
} }
tb[0].tbs = tbs; tb[0].tbs = tbs;
if (mcs >= 0) {
tb[0].mcs = mcs;
}
return true; return true;
} }

Loading…
Cancel
Save