rename pdcch_sched to sf_cch_allocator

master
Francisco 4 years ago committed by Francisco Paisana
parent fe452fae2b
commit 9a9ed01dda

@ -14,7 +14,7 @@
#define SRSLTE_SCHED_GRID_H
#include "lib/include/srslte/interfaces/sched_interface.h"
#include "sched_phy_ch/pdcch_sched.h"
#include "sched_phy_ch/sf_cch_allocator.h"
#include "sched_ue.h"
#include "srslte/adt/bounded_bitset.h"
#include "srslte/common/log.h"
@ -109,10 +109,10 @@ public:
bool find_ul_alloc(uint32_t L, prb_interval* alloc) const;
// getters
const rbgmask_t& get_dl_mask() const { return dl_mask; }
const prbmask_t& get_ul_mask() const { return ul_mask; }
uint32_t get_cfi() const { return pdcch_alloc.get_cfi(); }
const pdcch_sched& get_pdcch_grid() const { return pdcch_alloc; }
const rbgmask_t& get_dl_mask() const { return dl_mask; }
const prbmask_t& get_ul_mask() const { return ul_mask; }
uint32_t get_cfi() const { return pdcch_alloc.get_cfi(); }
const sf_cch_allocator& get_pdcch_grid() const { return pdcch_alloc; }
private:
alloc_outcome_t alloc_dl(uint32_t aggr_lvl, alloc_type_t alloc_type, rbgmask_t alloc_mask, sched_ue* user = nullptr);
@ -124,7 +124,7 @@ private:
uint32_t si_n_rbg = 0, rar_n_rbg = 0;
// derived
pdcch_sched pdcch_alloc = {};
sf_cch_allocator pdcch_alloc = {};
// internal state
tti_point tti_rx;
@ -228,14 +228,16 @@ public:
private:
ctrl_code_t alloc_dl_ctrl(uint32_t aggr_lvl, uint32_t tbs_bytes, uint16_t rnti);
int generate_format1a(prb_interval prb_range, uint32_t tbs, uint32_t rv, uint16_t rnti, srslte_dci_dl_t* dci);
void set_bc_sched_result(const pdcch_sched::alloc_result_t& dci_result, sched_interface::dl_sched_res_t* dl_result);
void set_rar_sched_result(const pdcch_sched::alloc_result_t& dci_result, sched_interface::dl_sched_res_t* dl_result);
void set_dl_data_sched_result(const pdcch_sched::alloc_result_t& dci_result,
sched_interface::dl_sched_res_t* dl_result,
sched_ue_list& ue_list);
void set_ul_sched_result(const pdcch_sched::alloc_result_t& dci_result,
sched_interface::ul_sched_res_t* ul_result,
sched_ue_list& ue_list);
void set_bc_sched_result(const sf_cch_allocator::alloc_result_t& dci_result,
sched_interface::dl_sched_res_t* dl_result);
void set_rar_sched_result(const sf_cch_allocator::alloc_result_t& dci_result,
sched_interface::dl_sched_res_t* dl_result);
void set_dl_data_sched_result(const sf_cch_allocator::alloc_result_t& dci_result,
sched_interface::dl_sched_res_t* dl_result,
sched_ue_list& ue_list);
void set_ul_sched_result(const sf_cch_allocator::alloc_result_t& dci_result,
sched_interface::ul_sched_res_t* ul_result,
sched_ue_list& ue_list);
// consts
const sched_cell_params_t* cc_cfg = nullptr;

@ -20,7 +20,7 @@ namespace srsenb {
class sched_ue;
/// Class responsible for managing a PDCCH CCE grid, namely CCE allocs, and avoid collisions.
class pdcch_sched
class sf_cch_allocator
{
public:
const static uint32_t MAX_CFI = 3;
@ -32,7 +32,7 @@ public:
};
using alloc_result_t = std::vector<const alloc_t*>;
pdcch_sched() : logger(srslog::fetch_basic_logger("MAC")) {}
sf_cch_allocator() : logger(srslog::fetch_basic_logger("MAC")) {}
void init(const sched_cell_params_t& cell_params_);
void new_tti(tti_point tti_rx_);

@ -9,7 +9,7 @@
add_subdirectory(schedulers)
set(SOURCES mac.cc ue.cc sched.cc sched_carrier.cc sched_grid.cc sched_ue_ctrl/sched_harq.cc sched_ue.cc
sched_ue_ctrl/sched_lch.cc sched_ue_ctrl/sched_ue_cell.cc sched_phy_ch/pdcch_sched.cc sched_helpers.cc)
sched_ue_ctrl/sched_lch.cc sched_ue_ctrl/sched_ue_cell.cc sched_phy_ch/sf_cch_allocator.cc sched_helpers.cc)
add_library(srsenb_mac STATIC ${SOURCES} $<TARGET_OBJECTS:mac_schedulers>)
if(ENABLE_5GNR)

@ -657,8 +657,8 @@ bool sf_sched::alloc_phich(sched_ue* user, sched_interface::ul_sched_res_t* ul_s
return false;
}
void sf_sched::set_bc_sched_result(const pdcch_sched::alloc_result_t& dci_result,
sched_interface::dl_sched_res_t* dl_result)
void sf_sched::set_bc_sched_result(const sf_cch_allocator::alloc_result_t& dci_result,
sched_interface::dl_sched_res_t* dl_result)
{
for (const auto& bc_alloc : bc_allocs) {
sched_interface::dl_sched_bc_t* bc = &dl_result->bc[dl_result->nof_bc_elems];
@ -724,8 +724,8 @@ void sf_sched::set_bc_sched_result(const pdcch_sched::alloc_result_t& dci_result
}
}
void sf_sched::set_rar_sched_result(const pdcch_sched::alloc_result_t& dci_result,
sched_interface::dl_sched_res_t* dl_result)
void sf_sched::set_rar_sched_result(const sf_cch_allocator::alloc_result_t& dci_result,
sched_interface::dl_sched_res_t* dl_result)
{
for (const auto& rar_alloc : rar_allocs) {
sched_interface::dl_sched_rar_t* rar = &dl_result->rar[dl_result->nof_rar_elems];
@ -768,9 +768,9 @@ void sf_sched::set_rar_sched_result(const pdcch_sched::alloc_result_t& dci_resul
}
}
void sf_sched::set_dl_data_sched_result(const pdcch_sched::alloc_result_t& dci_result,
sched_interface::dl_sched_res_t* dl_result,
sched_ue_list& ue_list)
void sf_sched::set_dl_data_sched_result(const sf_cch_allocator::alloc_result_t& dci_result,
sched_interface::dl_sched_res_t* dl_result,
sched_ue_list& ue_list)
{
for (const auto& data_alloc : data_allocs) {
sched_interface::dl_sched_data_t* data = &dl_result->data[dl_result->nof_data_elems];
@ -906,9 +906,9 @@ uci_pusch_t is_uci_included(const sf_sched* sf_sched,
}
}
void sf_sched::set_ul_sched_result(const pdcch_sched::alloc_result_t& dci_result,
sched_interface::ul_sched_res_t* ul_result,
sched_ue_list& ue_list)
void sf_sched::set_ul_sched_result(const sf_cch_allocator::alloc_result_t& dci_result,
sched_interface::ul_sched_res_t* ul_result,
sched_ue_list& ue_list)
{
/* Set UL data DCI locs and format */
for (const auto& ul_alloc : ul_data_allocs) {
@ -1011,7 +1011,7 @@ void sf_sched::generate_sched_results(sched_ue_list& ue_db)
}
/* Pick one of the possible DCI masks */
pdcch_sched::alloc_result_t dci_result;
sf_cch_allocator::alloc_result_t dci_result;
// tti_alloc.get_pdcch_grid().result_to_string();
tti_alloc.get_pdcch_grid().get_allocs(&dci_result, &cc_result->pdcch_mask);

@ -10,19 +10,19 @@
*
*/
#include "srsenb/hdr/stack/mac/sched_phy_ch/pdcch_sched.h"
#include "srsenb/hdr/stack/mac/sched_phy_ch/sf_cch_allocator.h"
#include "srsenb/hdr/stack/mac/sched_grid.h"
namespace srsenb {
void pdcch_sched::alloc_tree_t::reset()
void sf_cch_allocator::alloc_tree_t::reset()
{
prev_start = 0;
prev_end = 0;
dci_alloc_tree.clear();
}
void pdcch_sched::init(const sched_cell_params_t& cell_params_)
void sf_cch_allocator::init(const sched_cell_params_t& cell_params_)
{
cc_cfg = &cell_params_;
@ -33,7 +33,7 @@ void pdcch_sched::init(const sched_cell_params_t& cell_params_)
}
}
void pdcch_sched::new_tti(tti_point tti_rx_)
void sf_cch_allocator::new_tti(tti_point tti_rx_)
{
tti_rx = tti_rx_;
@ -46,7 +46,7 @@ void pdcch_sched::new_tti(tti_point tti_rx_)
}
const cce_cfi_position_table*
pdcch_sched::get_cce_loc_table(alloc_type_t alloc_type, sched_ue* user, uint32_t cfix) const
sf_cch_allocator::get_cce_loc_table(alloc_type_t alloc_type, sched_ue* user, uint32_t cfix) const
{
switch (alloc_type) {
case alloc_type_t::DL_BC:
@ -65,7 +65,7 @@ pdcch_sched::get_cce_loc_table(alloc_type_t alloc_type, sched_ue* user, uint32_t
return nullptr;
}
bool pdcch_sched::alloc_dci(alloc_type_t alloc_type, uint32_t aggr_idx, sched_ue* user)
bool sf_cch_allocator::alloc_dci(alloc_type_t alloc_type, uint32_t aggr_idx, sched_ue* user)
{
// TODO: Make the alloc tree update lazy
alloc_record_t record{.user = user, .aggr_idx = aggr_idx, .alloc_type = alloc_type};
@ -90,7 +90,7 @@ bool pdcch_sched::alloc_dci(alloc_type_t alloc_type, uint32_t aggr_idx, sched_ue
return true;
}
bool pdcch_sched::alloc_dci_record(const alloc_record_t& record, uint32_t cfix)
bool sf_cch_allocator::alloc_dci_record(const alloc_record_t& record, uint32_t cfix)
{
bool ret = false;
auto& tree = alloc_trees[cfix];
@ -118,11 +118,11 @@ bool pdcch_sched::alloc_dci_record(const alloc_record_t& record, uint32_t cfix)
}
//! Algorithm to compute a valid PDCCH allocation
bool pdcch_sched::add_tree_node_leaves(alloc_tree_t& tree,
int parent_node_idx,
const alloc_record_t& dci_record,
const cce_cfi_position_table& dci_locs,
tti_point tti_tx_dl)
bool sf_cch_allocator::add_tree_node_leaves(alloc_tree_t& tree,
int parent_node_idx,
const alloc_record_t& dci_record,
const cce_cfi_position_table& dci_locs,
tti_point tti_tx_dl)
{
bool ret = false;
@ -177,7 +177,7 @@ bool pdcch_sched::add_tree_node_leaves(alloc_tree_t& tree,
return ret;
}
bool pdcch_sched::set_cfi(uint32_t cfi)
bool sf_cch_allocator::set_cfi(uint32_t cfi)
{
if (cfi < cc_cfg->sched_cfg->min_nof_ctrl_symbols or cfi > cc_cfg->sched_cfg->max_nof_ctrl_symbols) {
logger.error("Invalid CFI value. Defaulting to current CFI.");
@ -213,7 +213,7 @@ bool pdcch_sched::set_cfi(uint32_t cfi)
return true;
}
void pdcch_sched::get_allocs(alloc_result_t* vec, pdcch_mask_t* tot_mask, size_t idx) const
void sf_cch_allocator::get_allocs(alloc_result_t* vec, pdcch_mask_t* tot_mask, size_t idx) const
{
auto& tree = alloc_trees[current_cfix];
// if alloc tree is empty
@ -246,7 +246,7 @@ void pdcch_sched::get_allocs(alloc_result_t* vec, pdcch_mask_t* tot_mask, size_t
}
}
std::string pdcch_sched::result_to_string(bool verbose) const
std::string sf_cch_allocator::result_to_string(bool verbose) const
{
auto& tree = alloc_trees[current_cfix];
std::stringstream ss;

@ -45,8 +45,8 @@ int test_pdcch_one_ue()
sched_interface::sched_args_t sched_args{};
TESTASSERT(cell_params[ENB_CC_IDX].set_cfg(ENB_CC_IDX, cell_cfg, sched_args));
pdcch_sched pdcch;
sched_ue sched_ue{rnti, cell_params, ue_cfg};
sf_cch_allocator pdcch;
sched_ue sched_ue{rnti, cell_params, ue_cfg};
pdcch.init(cell_params[PCell_IDX]);
TESTASSERT(pdcch.nof_alloc_combinations() == 0);
@ -64,7 +64,7 @@ int test_pdcch_one_ue()
sched_ue.set_dl_cqi(to_tx_dl(tti_rx), ENB_CC_IDX, dl_cqi);
uint32_t aggr_idx = get_aggr_level(sched_ue, PCell_IDX, cell_params);
uint32_t max_nof_cce_locs =
(*sched_ue.get_locations(ENB_CC_IDX, pdcch_sched::MAX_CFI, to_tx_dl(tti_rx).sf_idx()))[aggr_idx].size();
(*sched_ue.get_locations(ENB_CC_IDX, sf_cch_allocator::MAX_CFI, to_tx_dl(tti_rx).sf_idx()))[aggr_idx].size();
// allocate DL user
uint32_t prev_cfi = pdcch.get_cfi();
@ -85,8 +85,8 @@ int test_pdcch_one_ue()
const cce_position_list& dci_locs = (*dci_cce)[aggr_idx];
// TEST: Check the first alloc of the pdcch result (e.g. rnti, valid cce mask, etc.)
pdcch_sched::alloc_result_t pdcch_result;
pdcch_mask_t pdcch_mask;
sf_cch_allocator::alloc_result_t pdcch_result;
pdcch_mask_t pdcch_mask;
pdcch.get_allocs(&pdcch_result, &pdcch_mask, 0);
TESTASSERT(pdcch_result.size() == 1);
TESTASSERT(pdcch_result[0]->rnti == sched_ue.get_rnti());

Loading…
Cancel
Save