perform PUCCH+PRACH PRB reservation right at the start of a new TTI in the scheduler

This commit is contained in:
Francisco Paisana 2020-09-14 14:54:33 +02:00
parent 3088cdbb0f
commit 7e6487b6fa
4 changed files with 19 additions and 25 deletions

View File

@ -65,10 +65,6 @@ private:
std::unique_ptr<metric_ul> ul_metric;
const uint32_t enb_cc_idx;
// derived from args
prbmask_t prach_mask;
prbmask_t pucch_mask;
// Subframe scheduling logic
std::array<sf_sched, TTIMOD_SZ> sf_scheds;

View File

@ -326,6 +326,7 @@ private:
const sched_cell_params_t* cc_cfg = nullptr;
srslte::log_ref log_h;
sf_sched_result* cc_results; ///< Results of other CCs for the same Subframe
prbmask_t pucch_mask;
// internal state
sf_grid_t tti_alloc;

View File

@ -297,15 +297,6 @@ void sched::carrier_sched::carrier_cfg(const sched_cell_params_t& cell_params_)
ul_metric.reset(new srsenb::ul_metric_rr{});
ul_metric->set_params(*cc_cfg);
// Setup constant PUCCH/PRACH mask
pucch_mask.resize(cc_cfg->nof_prb());
if (cc_cfg->cfg.nrb_pucch > 0) {
pucch_mask.fill(0, (uint32_t)cc_cfg->cfg.nrb_pucch);
pucch_mask.fill(cc_cfg->nof_prb() - cc_cfg->cfg.nrb_pucch, cc_cfg->nof_prb());
}
prach_mask.resize(cc_cfg->nof_prb());
prach_mask.fill(cc_cfg->cfg.prach_freq_offset, cc_cfg->cfg.prach_freq_offset + 6);
// Initiate the tti_scheduler for each TTI
for (sf_sched& tti_sched : sf_scheds) {
tti_sched.init(*cc_cfg);
@ -391,17 +382,6 @@ void sched::carrier_sched::alloc_dl_users(sf_sched* tti_result)
int sched::carrier_sched::alloc_ul_users(sf_sched* tti_sched)
{
uint32_t tti_tx_ul = tti_sched->get_tti_tx_ul();
/* reserve PRBs for PRACH */
if (srslte_prach_tti_opportunity_config_fdd(cc_cfg->cfg.prach_config, tti_tx_ul, -1)) {
tti_sched->reserve_ul_prbs(prach_mask, false);
log_h->debug("SCHED: Allocated PRACH RBs. Mask: 0x%s\n", prach_mask.to_hex().c_str());
}
/* reserve PRBs for PUCCH */
tti_sched->reserve_ul_prbs(pucch_mask, cc_cfg->nof_prb() != 6);
/* Call scheduler for UL data */
ul_metric->sched_users(*ue_db, tti_sched);

View File

@ -570,6 +570,12 @@ void sf_sched::init(const sched_cell_params_t& cell_params_)
cc_cfg = &cell_params_;
tti_alloc.init(*cc_cfg);
max_msg3_prb = std::max(6u, cc_cfg->cfg.cell.nof_prb - (uint32_t)cc_cfg->cfg.nrb_pucch);
pucch_mask.resize(cc_cfg->nof_prb());
if (cc_cfg->cfg.nrb_pucch > 0) {
pucch_mask.fill(0, (uint32_t)cc_cfg->cfg.nrb_pucch);
pucch_mask.fill(cc_cfg->nof_prb() - cc_cfg->cfg.nrb_pucch, cc_cfg->nof_prb());
}
}
void sf_sched::new_tti(uint32_t tti_rx_, sf_sched_result* cc_results_)
@ -584,6 +590,17 @@ void sf_sched::new_tti(uint32_t tti_rx_, sf_sched_result* cc_results_)
tti_alloc.new_tti(tti_params);
cc_results = cc_results_;
// Reserve PRBs for PUCCH
reserve_ul_prbs(pucch_mask, true);
// Reserve PRBs for PRACH
if (srslte_prach_tti_opportunity_config_fdd(cc_cfg->cfg.prach_config, tti_params.tti_tx_ul, -1)) {
prbmask_t prach_mask{cc_cfg->nof_prb()};
prach_mask.fill(cc_cfg->cfg.prach_freq_offset, cc_cfg->cfg.prach_freq_offset + 6);
reserve_ul_prbs(prach_mask, cc_cfg->nof_prb() != 6);
log_h->debug("SCHED: Allocated PRACH RBs. Mask: 0x%s\n", prach_mask.to_hex().c_str());
}
// setup first prb to be used for msg3 alloc. Account for potential PRACH alloc
last_msg3_prb = cc_cfg->cfg.nrb_pucch;
uint32_t tti_msg3_alloc = TTI_ADD(tti_params.tti_tx_ul, MSG3_DELAY_MS);