diff --git a/srsenb/hdr/stack/mac/scheduler_carrier.h b/srsenb/hdr/stack/mac/scheduler_carrier.h index a8404c1e5..346a788c3 100644 --- a/srsenb/hdr/stack/mac/scheduler_carrier.h +++ b/srsenb/hdr/stack/mac/scheduler_carrier.h @@ -150,9 +150,9 @@ public: // private: void generate_phich(tti_sched_result_t* tti_sched); //! Compute DL scheduler result for given TTI - int generate_dl_sched(tti_sched_result_t* tti_result); + void alloc_dl_users(tti_sched_result_t* tti_result); //! Compute UL scheduler result for given TTI - int generate_ul_sched(tti_sched_result_t* tti_sched); + int alloc_ul_users(tti_sched_result_t* tti_sched); // args sched* sched_ptr = nullptr; diff --git a/srsenb/hdr/stack/mac/scheduler_grid.h b/srsenb/hdr/stack/mac/scheduler_grid.h index a343dd018..6313963e2 100644 --- a/srsenb/hdr/stack/mac/scheduler_grid.h +++ b/srsenb/hdr/stack/mac/scheduler_grid.h @@ -67,11 +67,11 @@ public: // getters uint32_t get_cfi() const { return current_cfix + 1; } void get_allocs(alloc_result_t* vec = nullptr, pdcch_mask_t* tot_mask = nullptr, size_t idx = 0) const; - uint32_t nof_cces() const { return cce_size_array[current_cfix]; } - size_t nof_allocs() const { return nof_dci_allocs; } - size_t nof_alloc_combinations() const { return prev_end - prev_start; } - void print_result(bool verbose = false) const; - uint32_t get_sf_idx() const { return sf_idx; } + uint32_t nof_cces() const { return cce_size_array[current_cfix]; } + size_t nof_allocs() const { return nof_dci_allocs; } + size_t nof_alloc_combinations() const { return prev_end - prev_start; } + std::string result_to_string(bool verbose = false) const; + uint32_t get_sf_idx() const { return sf_idx; } private: const static uint32_t nof_cfis = 3; diff --git a/srsenb/src/stack/mac/scheduler_carrier.cc b/srsenb/src/stack/mac/scheduler_carrier.cc index b3cb357ef..c4a93132d 100644 --- a/srsenb/src/stack/mac/scheduler_carrier.cc +++ b/srsenb/src/stack/mac/scheduler_carrier.cc @@ -501,7 +501,7 @@ void sched::carrier_sched::tti_sched_result_t::generate_dcis() { /* Pick one of the possible DCI masks */ pdcch_grid_t::alloc_result_t dci_result; - // tti_alloc.get_pdcch_grid().print_result(); + // tti_alloc.get_pdcch_grid().result_to_string(); tti_alloc.get_pdcch_grid().get_allocs(&dci_result, &pdcch_mask); /* Register final CFI */ @@ -897,15 +897,30 @@ sched::carrier_sched::tti_sched_result_t* sched::carrier_sched::generate_tti_res /* Schedule PHICH */ generate_phich(tti_sched); - /* Schedule DL */ + /* Schedule DL control data */ if (tti_dl_mask[tti_sched->get_tti_tx_dl() % tti_dl_mask.size()] == 0) { - generate_dl_sched(tti_sched); + /* Schedule Broadcast data (SIB and paging) */ + if (bc_sched_ptr != nullptr) { + bc_sched_ptr->dl_sched(tti_sched); + } + + /* Schedule RAR */ + ra_sched_ptr->dl_sched(tti_sched); } - /* Schedule UL */ - generate_ul_sched(tti_sched); + /* Prioritize PDCCH scheduling for DL and UL data in a RoundRobin fashion */ + if ((tti_rx % 2) == 0) { + alloc_ul_users(tti_sched); + } + + /* Schedule DL user data */ + alloc_dl_users(tti_sched); + + if ((tti_rx % 2) == 1) { + alloc_ul_users(tti_sched); + } - /* Generate DCI */ + /* Select the winner DCI allocation combination */ tti_sched->generate_dcis(); /* reset PIDs with pending data or blocked */ @@ -945,18 +960,12 @@ void sched::carrier_sched::generate_phich(tti_sched_result_t* tti_sched) tti_sched->ul_sched_result.nof_phich_elems = nof_phich_elems; } -// Compute DL scheduler result -int sched::carrier_sched::generate_dl_sched(tti_sched_result_t* tti_result) +void sched::carrier_sched::alloc_dl_users(sched::carrier_sched::tti_sched_result_t* tti_result) { - /* Schedule Broadcast data (SIB and paging) */ - if (bc_sched_ptr != nullptr) { - bc_sched_ptr->dl_sched(tti_result); + if (tti_dl_mask[tti_result->get_tti_tx_dl() % tti_dl_mask.size()] != 0) { + return; } - /* Schedule RAR */ - ra_sched_ptr->dl_sched(tti_result); - - /* Schedule pending RLC data */ // NOTE: In case of 6 PRBs, do not transmit if there is going to be a PRACH in the UL to avoid collisions if (cfg->cell.nof_prb == 6) { uint32_t tti_rx_ack = TTI_RX_ACK(tti_result->get_tti_rx()); @@ -969,16 +978,14 @@ int sched::carrier_sched::generate_dl_sched(tti_sched_result_t* tti_result) } } - // call scheduler metric to fill RB grid + // call DL scheduler metric to fill RB grid dl_metric->sched_users(sched_ptr->ue_db, tti_result); - - return LIBLTE_SUCCESS; } -int sched::carrier_sched::generate_ul_sched(sched::carrier_sched::tti_sched_result_t* tti_result) +int sched::carrier_sched::alloc_ul_users(sched::carrier_sched::tti_sched_result_t* tti_sched) { - uint32_t tti_tx_ul = tti_result->get_tti_tx_ul(); - prbmask_t& ul_mask = tti_result->get_ul_mask(); + uint32_t tti_tx_ul = tti_sched->get_tti_tx_ul(); + prbmask_t& ul_mask = tti_sched->get_ul_mask(); /* reserve PRBs for PRACH */ if (srslte_prach_tti_opportunity_config_fdd(cfg->prach_config, tti_tx_ul, -1)) { @@ -987,7 +994,7 @@ int sched::carrier_sched::generate_ul_sched(sched::carrier_sched::tti_sched_resu } /* Allocate Msg3 if there's a pending RAR */ - ra_sched_ptr->ul_sched(tti_result); + ra_sched_ptr->ul_sched(tti_sched); /* reserve PRBs for PUCCH */ if (cfg->cell.nof_prb != 6 and (ul_mask & pucch_mask).any()) { @@ -998,7 +1005,7 @@ int sched::carrier_sched::generate_ul_sched(sched::carrier_sched::tti_sched_resu ul_mask |= pucch_mask; /* Call scheduler for UL data */ - ul_metric->sched_users(sched_ptr->ue_db, tti_result); + ul_metric->sched_users(sched_ptr->ue_db, tti_sched); /* Update pending data counters after this TTI */ for (auto& user : sched_ptr->ue_db) { diff --git a/srsenb/src/stack/mac/scheduler_grid.cc b/srsenb/src/stack/mac/scheduler_grid.cc index 3e344733e..105938cdf 100644 --- a/srsenb/src/stack/mac/scheduler_grid.cc +++ b/srsenb/src/stack/mac/scheduler_grid.cc @@ -226,14 +226,11 @@ void pdcch_grid_t::get_allocs(alloc_result_t* vec, pdcch_mask_t* tot_mask, size_ } } -void pdcch_grid_t::print_result(bool verbose) const +std::string pdcch_grid_t::result_to_string(bool verbose) const { - if (prev_start == prev_end) { - log_h->info("SCHED: No DCI allocations\n"); - } - std::stringstream ss; - ss << "SCHED: cfi=" << get_cfi() << ", " << prev_end - prev_start << " DCI allocation combinations:\n"; + ss << "cfi=" << get_cfi() << ", mask_size=" << nof_cces() << ", " << prev_end - prev_start + << " DCI allocation combinations:\n"; // get all the possible combinations of DCI allocations uint32_t count = 0; for (size_t i = prev_start; i < prev_end; ++i) { @@ -256,7 +253,7 @@ void pdcch_grid_t::print_result(bool verbose) const count++; } - log_h->info("%s", ss.str().c_str()); + return ss.str(); } /******************************************************* @@ -304,6 +301,13 @@ alloc_outcome_t tti_grid_t::alloc_dl(uint32_t aggr_lvl, alloc_type_t alloc_type, // Allocate DCI in PDCCH if (not pdcch_alloc.alloc_dci(alloc_type, aggr_lvl, user)) { + if (log_h->get_level() == srslte::LOG_LEVEL_DEBUG) { + if (user != nullptr) { + log_h->debug("No space in PDCCH for rnti=0x%x DL tx. Current PDCCH allocation: %s\n", + user->get_rnti(), + pdcch_alloc.result_to_string(true).c_str()); + } + } return alloc_outcome_t::DCI_COLLISION; } @@ -362,6 +366,11 @@ alloc_outcome_t tti_grid_t::alloc_ul_data(sched_ue* user, ul_harq_proc::ul_alloc uint32_t aggr_idx = user->get_aggr_level(srslte_dci_format_sizeof(&cell_cfg->cell, nullptr, nullptr, SRSLTE_DCI_FORMAT0)); if (not pdcch_alloc.alloc_dci(alloc_type_t::UL_DATA, aggr_idx, user)) { + if (log_h->get_level() == srslte::LOG_LEVEL_DEBUG) { + log_h->debug("No space in PDCCH for rnti=0x%x UL tx. Current PDCCH allocation: %s\n", + user->get_rnti(), + pdcch_alloc.result_to_string(true).c_str()); + } return alloc_outcome_t::DCI_COLLISION; } } diff --git a/srsenb/src/stack/mac/scheduler_metric.cc b/srsenb/src/stack/mac/scheduler_metric.cc index b8446408f..a75712c5c 100644 --- a/srsenb/src/stack/mac/scheduler_metric.cc +++ b/srsenb/src/stack/mac/scheduler_metric.cc @@ -244,7 +244,7 @@ ul_harq_proc* ul_metric_rr::allocate_user_retx_prbs(sched_ue* user) return h; } if (ret == alloc_outcome_t::DCI_COLLISION) { - log_h->warning("SCHED: Couldn't find space in PDCCH for UL tx of rnti=0x%x\n", user->get_rnti()); + log_h->warning("SCHED: Couldn't find space in PDCCH for UL retx of rnti=0x%x\n", user->get_rnti()); return nullptr; } @@ -254,7 +254,7 @@ ul_harq_proc* ul_metric_rr::allocate_user_retx_prbs(sched_ue* user) return h; } if (ret == alloc_outcome_t::DCI_COLLISION) { - log_h->warning("SCHED: Couldn't find space in PDCCH for UL tx of rnti=0x%x\n", user->get_rnti()); + log_h->warning("SCHED: Couldn't find space in PDCCH for UL retx of rnti=0x%x\n", user->get_rnti()); } } } diff --git a/srsue/src/stack/rrc/rrc_procedures.cc b/srsue/src/stack/rrc/rrc_procedures.cc index d9fc662a2..e94048839 100644 --- a/srsue/src/stack/rrc/rrc_procedures.cc +++ b/srsue/src/stack/rrc/rrc_procedures.cc @@ -190,7 +190,7 @@ proc_outcome_t rrc::si_acquire_proc::step() Info("SIB%d acquired successfully\n", sib_index + 1); return proc_outcome_t::success; } else { - Error("Timeout while acquiring SIB1\n"); + Error("Timeout while acquiring SIB%d\n", sib_index + 1); return proc_outcome_t::error; } } else {