bug fix in the PF scheduler. The correct history was not being stored for newtxs

This commit is contained in:
Francisco Paisana 2021-01-11 18:54:59 +00:00
parent da0e64c51a
commit bc8e65c82f
3 changed files with 32 additions and 16 deletions

View File

@ -147,13 +147,13 @@ public:
rbg_interval get_required_dl_rbgs(uint32_t ue_cc_idx);
srslte::interval<uint32_t> get_requested_dl_bytes(uint32_t ue_cc_idx);
uint32_t get_pending_dl_rlc_data() const;
uint32_t get_expected_dl_bitrate(uint32_t ue_cc_idx) const;
uint32_t get_expected_dl_bitrate(uint32_t ue_cc_idx, int nof_rbgs = -1) const;
uint32_t get_pending_ul_data_total(tti_point tti_tx_ul, int this_ue_cc_idx);
uint32_t get_pending_ul_new_data(tti_point tti_tx_ul, int this_ue_cc_idx);
uint32_t get_pending_ul_old_data();
uint32_t get_pending_ul_old_data(uint32_t cc_idx);
uint32_t get_expected_ul_bitrate(uint32_t ue_cc_idx) const;
uint32_t get_expected_ul_bitrate(uint32_t ue_cc_idx, int nof_prbs = -1) const;
dl_harq_proc* get_pending_dl_harq(tti_point tti_tx_dl, uint32_t cc_idx);
dl_harq_proc* get_empty_dl_harq(tti_point tti_tx_dl, uint32_t cc_idx);

View File

@ -1011,13 +1011,14 @@ uint32_t sched_ue::get_pending_dl_rlc_data() const
return pending_data;
}
uint32_t sched_ue::get_expected_dl_bitrate(uint32_t ue_cc_idx) const
uint32_t sched_ue::get_expected_dl_bitrate(uint32_t ue_cc_idx, int nof_rbgs) const
{
const cc_sched_ue* cc = &carriers[ue_cc_idx];
const cc_sched_ue* cc = &carriers[ue_cc_idx];
auto* cell_cfg = carriers[ue_cc_idx].get_cell_cfg();
uint32_t nof_prbs_alloc = nof_rbgs < 0 ? cell_cfg->nof_prb() : std::min(nof_rbgs * cell_cfg->P, cell_cfg->nof_prb());
auto* cell_cfg = carriers[ue_cc_idx].get_cell_cfg();
uint32_t nof_re =
srslte_ra_dl_approx_nof_re(&cell_cfg->cfg.cell, cell_cfg->nof_prb(), cell_cfg->sched_cfg->max_nof_ctrl_symbols);
srslte_ra_dl_approx_nof_re(&cell_cfg->cfg.cell, nof_prbs_alloc, cell_cfg->sched_cfg->max_nof_ctrl_symbols);
float max_coderate = srslte_cqi_to_coderate(std::min(cc->dl_cqi + 1u, 15u), cfg.use_tbs_index_alt);
// Inverse of srslte_coderate(tbs, nof_re)
@ -1025,13 +1026,14 @@ uint32_t sched_ue::get_expected_dl_bitrate(uint32_t ue_cc_idx) const
return tbs / tti_duration_ms;
}
uint32_t sched_ue::get_expected_ul_bitrate(uint32_t ue_cc_idx) const
uint32_t sched_ue::get_expected_ul_bitrate(uint32_t ue_cc_idx, int nof_prbs) const
{
const cc_sched_ue* cc = &carriers[ue_cc_idx];
const cc_sched_ue* cc = &carriers[ue_cc_idx];
uint32_t nof_prbs_alloc = nof_prbs < 0 ? cell.nof_prb : nof_prbs;
uint32_t N_srs = 0;
uint32_t nof_symb = 2 * (SRSLTE_CP_NSYMB(cell.cp) - 1) - N_srs;
uint32_t nof_re = nof_symb * cell.nof_prb * SRSLTE_NRE;
uint32_t nof_re = nof_symb * nof_prbs_alloc * SRSLTE_NRE;
float max_coderate = srslte_cqi_to_coderate(std::min(cc->ul_cqi + 1u, 15u), false);
// Inverse of srslte_coderate(tbs, nof_re)

View File

@ -90,7 +90,7 @@ uint32_t sched_time_pf::try_dl_alloc(ue_ctxt& ue_ctxt, sched_ue& ue, sf_sched* t
// empty RBGs were found
code = tti_sched->alloc_dl_user(&ue, newtx_mask, ue_ctxt.dl_newtx_h->get_id());
if (code == alloc_outcome_t::SUCCESS) {
return ue_ctxt.dl_newtx_h->get_tbs(0) + ue_ctxt.dl_newtx_h->get_tbs(1);
return ue.get_expected_dl_bitrate(ue_ctxt.ue_cc_idx, newtx_mask.count()) * tti_duration_ms / 8;
}
}
}
@ -120,10 +120,21 @@ void sched_time_pf::sched_ul_users(std::map<uint16_t, sched_ue>& ue_db, sf_sched
uint32_t sched_time_pf::try_ul_alloc(ue_ctxt& ue_ctxt, sched_ue& ue, sf_sched* tti_sched)
{
alloc_outcome_t code = alloc_outcome_t::ERROR;
if (ue_ctxt.ul_h != nullptr and ue_ctxt.ul_h->has_pending_retx()) {
code = try_ul_retx_alloc(*tti_sched, ue, *ue_ctxt.ul_h);
} else if (ue_ctxt.ul_h != nullptr and not tti_sched->is_ul_alloc(ue_ctxt.rnti)) {
if (ue_ctxt.ul_h == nullptr) {
// In case the UL HARQ could not be allocated (e.g. meas gap occurrence)
return 0;
}
if (tti_sched->is_ul_alloc(ue_ctxt.rnti)) {
// NOTE: An UL grant could have been previously allocated for UCI
return ue_ctxt.ul_h->get_pending_data();
}
alloc_outcome_t code;
uint32_t estim_tbs_bytes = 0;
if (ue_ctxt.ul_h->has_pending_retx()) {
code = try_ul_retx_alloc(*tti_sched, ue, *ue_ctxt.ul_h);
estim_tbs_bytes = code == alloc_outcome_t::SUCCESS ? ue_ctxt.ul_h->get_pending_data() : 0;
} else {
// Note: h->is_empty check is required, in case CA allocated a small UL grant for UCI
uint32_t pending_data = ue.get_pending_ul_new_data(tti_sched->get_tti_tx_ul(), ue_ctxt.ue_cc_idx);
// Check if there is a empty harq, and data to transmit
@ -135,12 +146,15 @@ uint32_t sched_time_pf::try_ul_alloc(ue_ctxt& ue_ctxt, sched_ue& ue, sf_sched* t
if (alloc.empty()) {
return 0;
}
code = tti_sched->alloc_ul_user(&ue, alloc);
code = tti_sched->alloc_ul_user(&ue, alloc);
estim_tbs_bytes = code == alloc_outcome_t::SUCCESS
? ue.get_expected_ul_bitrate(ue_ctxt.ue_cc_idx, alloc.length()) * tti_duration_ms / 8
: 0;
}
if (code == alloc_outcome_t::DCI_COLLISION) {
log_h->info("SCHED: Couldn't find space in PDCCH for UL retx of rnti=0x%x\n", ue.get_rnti());
}
return code == alloc_outcome_t::SUCCESS ? ue_ctxt.ul_h->get_pending_data() : 0;
return estim_tbs_bytes;
}
/*****************************************************************