mirror of https://github.com/PentHertz/srsLTE.git
nr,gnb,sched: cache ue phy dci_cfg to avoid computing it at every slot
This commit is contained in:
parent
949c34112e
commit
c3d682bba8
|
@ -17,7 +17,6 @@
|
|||
namespace srsran {
|
||||
|
||||
srsran_dci_cfg_nr_t phy_cfg_nr_t::get_dci_cfg() const
|
||||
|
||||
{
|
||||
srsran_dci_cfg_nr_t dci_cfg = {};
|
||||
|
||||
|
|
|
@ -188,15 +188,18 @@ public:
|
|||
int fixed_pdsch_mcs() const { return bwp_cfg->sched_cfg.fixed_dl_mcs; }
|
||||
int fixed_pusch_mcs() const { return bwp_cfg->sched_cfg.fixed_ul_mcs; }
|
||||
|
||||
srsran::bounded_vector<uint32_t, SRSRAN_UE_DL_NR_MAX_NOF_SEARCH_SPACE>
|
||||
find_ss_candidates(uint32_t aggr_idx, srsran::const_span<srsran_dci_format_nr_t> supported_dci_fmts) const;
|
||||
const srsran_dci_cfg_nr_t& get_dci_cfg() const { return cached_dci_cfg; }
|
||||
|
||||
int find_ss_id(srsran_dci_format_nr_t dci_fmt) const;
|
||||
|
||||
private:
|
||||
const ue_cfg_t* cfg_ = nullptr;
|
||||
const bwp_params_t* bwp_cfg = nullptr;
|
||||
|
||||
// derived
|
||||
std::vector<bwp_cce_pos_list> cce_positions_list;
|
||||
std::array<uint32_t, SRSRAN_UE_DL_NR_MAX_NOF_SEARCH_SPACE> ss_id_to_cce_idx;
|
||||
srsran_dci_cfg_nr_t cached_dci_cfg;
|
||||
};
|
||||
|
||||
} // namespace sched_nr_impl
|
||||
|
|
|
@ -171,8 +171,6 @@ public:
|
|||
dl_harq_proc* find_empty_dl_harq() { return ue->harq_ent.find_empty_dl_harq(); }
|
||||
ul_harq_proc* find_empty_ul_harq() { return ue->harq_ent.find_empty_ul_harq(); }
|
||||
|
||||
int find_ss_id(srsran_dci_format_nr_t dci_fmt) const;
|
||||
|
||||
void build_pdu(uint32_t rem_bytes, sched_nr_interface::dl_pdu_t& pdu)
|
||||
{
|
||||
ue->pdu_builder.alloc_subpdus(rem_bytes, pdu);
|
||||
|
|
|
@ -148,7 +148,7 @@ sched_params_t::sched_params_t(const sched_args_t& sched_cfg_) : sched_cfg(sched
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ue_carrier_params_t::ue_carrier_params_t(uint16_t rnti_, const bwp_params_t& bwp_cfg_, const ue_cfg_t& uecfg_) :
|
||||
rnti(rnti_), cc(bwp_cfg_.cc), cfg_(&uecfg_), bwp_cfg(&bwp_cfg_)
|
||||
rnti(rnti_), cc(bwp_cfg_.cc), cfg_(&uecfg_), bwp_cfg(&bwp_cfg_), cached_dci_cfg(uecfg_.phy_cfg.get_dci_cfg())
|
||||
{
|
||||
std::fill(ss_id_to_cce_idx.begin(), ss_id_to_cce_idx.end(), SRSRAN_UE_DL_NR_MAX_NOF_SEARCH_SPACE);
|
||||
const auto& pdcch = phy().pdcch;
|
||||
|
@ -165,5 +165,29 @@ ue_carrier_params_t::ue_carrier_params_t(uint16_t rnti_, const bwp_params_t& bwp
|
|||
}
|
||||
}
|
||||
|
||||
int ue_carrier_params_t::find_ss_id(srsran_dci_format_nr_t dci_fmt) const
|
||||
{
|
||||
static const uint32_t aggr_idx = 2; // TODO: Make it dynamic
|
||||
static const srsran_rnti_type_t rnti_type = srsran_rnti_type_c; // TODO: Use TC-RNTI for Msg4
|
||||
|
||||
auto active_ss_lst = view_active_search_spaces(phy().pdcch);
|
||||
|
||||
for (const srsran_search_space_t& ss : active_ss_lst) {
|
||||
// Prioritize UE-dedicated SearchSpaces
|
||||
if (ss.type == srsran_search_space_type_ue and ss.nof_candidates[aggr_idx] > 0 and
|
||||
contains_dci_format(ss, dci_fmt) and is_rnti_type_valid_in_search_space(rnti_type, ss.type)) {
|
||||
return ss.id;
|
||||
}
|
||||
}
|
||||
// Search Common SearchSpaces
|
||||
for (const srsran_search_space_t& ss : active_ss_lst) {
|
||||
if (SRSRAN_SEARCH_SPACE_IS_COMMON(ss.type) and ss.nof_candidates[aggr_idx] > 0 and
|
||||
contains_dci_format(ss, dci_fmt) and is_rnti_type_valid_in_search_space(rnti_type, ss.type)) {
|
||||
return ss.id;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
} // namespace sched_nr_impl
|
||||
} // namespace srsenb
|
|
@ -222,16 +222,16 @@ alloc_result bwp_slot_allocator::alloc_rar_and_msg3(uint16_t
|
|||
pdsch_t& pdsch = bwp_pdcch_slot.pdschs.alloc_pdsch_unchecked(pdcch.dci.ctx, interv, pdcch.dci);
|
||||
|
||||
// Generate DCI for RAR with given RA-RNTI
|
||||
auto& phy_cfg = slot_ues[pending_rachs[0].temp_crnti]->phy();
|
||||
pdcch.dci_cfg = phy_cfg.get_dci_cfg();
|
||||
pdcch.dci_cfg = slot_ues[pending_rachs[0].temp_crnti]->get_dci_cfg();
|
||||
pdcch.dci.mcs = 5;
|
||||
|
||||
// Generate RAR PDSCH
|
||||
// TODO: Properly fill Msg3 grants
|
||||
srsran_slot_cfg_t slot_cfg;
|
||||
slot_cfg.idx = pdcch_slot.to_uint();
|
||||
bool success = phy_cfg.get_pdsch_cfg(slot_cfg, pdcch.dci, pdsch.sch);
|
||||
srsran_assert(success, "Error converting DCI to grant");
|
||||
int code = srsran_ra_dl_dci_to_grant_nr(
|
||||
&cfg.cell_cfg.carrier, &slot_cfg, &cfg.cfg.pdsch, &pdcch.dci, &pdsch.sch, &pdsch.sch.grant);
|
||||
srsran_assert(code == SRSRAN_SUCCESS, "Error converting DCI to grant");
|
||||
pdsch.sch.grant.tb[0].softbuffer.tx = bwp_pdcch_slot.rar_softbuffer->get();
|
||||
|
||||
// Generate Msg3 grants in PUSCH
|
||||
|
@ -249,8 +249,8 @@ alloc_result bwp_slot_allocator::alloc_rar_and_msg3(uint16_t
|
|||
rar_grant.data = grant;
|
||||
prb_interval msg3_interv{last_msg3, last_msg3 + msg3_nof_prbs};
|
||||
last_msg3 += msg3_nof_prbs;
|
||||
ue.h_ul = ue.find_empty_ul_harq();
|
||||
success = ue.h_ul->new_tx(msg3_slot, msg3_slot, msg3_interv, mcs, max_harq_msg3_retx);
|
||||
ue.h_ul = ue.find_empty_ul_harq();
|
||||
bool success = ue.h_ul->new_tx(msg3_slot, msg3_slot, msg3_interv, mcs, max_harq_msg3_retx);
|
||||
srsran_assert(success, "Failed to allocate Msg3");
|
||||
fill_dci_msg3(ue, *bwp_grid.cfg, rar_grant.msg3_dci);
|
||||
|
||||
|
@ -331,7 +331,7 @@ alloc_result bwp_slot_allocator::alloc_pdsch(slot_ue& ue, uint32_t ss_id, const
|
|||
bwp_uci_slot.pending_acks.end(),
|
||||
[&ue](const harq_ack_t& p) { return p.res.rnti == ue->rnti; });
|
||||
pdcch.dci.dai %= 4;
|
||||
pdcch.dci_cfg = ue->phy().get_dci_cfg();
|
||||
pdcch.dci_cfg = ue->get_dci_cfg();
|
||||
|
||||
// Generate PUCCH
|
||||
bwp_uci_slot.pending_acks.emplace_back();
|
||||
|
@ -423,7 +423,7 @@ alloc_result bwp_slot_allocator::alloc_pusch(slot_ue& ue, const prb_grant& ul_gr
|
|||
|
||||
// Generate PDCCH content
|
||||
fill_ul_dci_ue_fields(ue, pdcch.dci);
|
||||
pdcch.dci_cfg = ue->phy().get_dci_cfg();
|
||||
pdcch.dci_cfg = ue->get_dci_cfg();
|
||||
|
||||
// Generate PUSCH content
|
||||
srsran_slot_cfg_t slot_cfg;
|
||||
|
|
|
@ -47,7 +47,7 @@ void sched_nr_time_rr::sched_dl_users(slot_ue_map_t& ue_db, bwp_slot_allocator&
|
|||
// Start with retxs
|
||||
auto retx_ue_function = [&slot_alloc](slot_ue& ue) {
|
||||
if (ue.h_dl != nullptr and ue.h_dl->has_pending_retx(slot_alloc.get_tti_rx())) {
|
||||
alloc_result res = slot_alloc.alloc_pdsch(ue, ue.find_ss_id(srsran_dci_format_nr_1_0), ue.h_dl->prbs());
|
||||
alloc_result res = slot_alloc.alloc_pdsch(ue, ue->find_ss_id(srsran_dci_format_nr_1_0), ue.h_dl->prbs());
|
||||
if (res == alloc_result::success) {
|
||||
return true;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ void sched_nr_time_rr::sched_dl_users(slot_ue_map_t& ue_db, bwp_slot_allocator&
|
|||
// Move on to new txs
|
||||
auto newtx_ue_function = [&slot_alloc](slot_ue& ue) {
|
||||
if (ue.dl_bytes > 0 and ue.h_dl != nullptr and ue.h_dl->empty()) {
|
||||
int ss_id = ue.find_ss_id(srsran_dci_format_nr_1_0);
|
||||
int ss_id = ue->find_ss_id(srsran_dci_format_nr_1_0);
|
||||
if (ss_id < 0) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -83,30 +83,6 @@ slot_ue::slot_ue(ue_carrier& ue_, slot_point slot_tx_, uint32_t dl_pending_bytes
|
|||
}
|
||||
}
|
||||
|
||||
int slot_ue::find_ss_id(srsran_dci_format_nr_t dci_fmt) const
|
||||
{
|
||||
static const uint32_t aggr_idx = 2; // TODO: Make it dynamic
|
||||
static const srsran_rnti_type_t rnti_type = srsran_rnti_type_c; // TODO: Use TC-RNTI for Msg4
|
||||
|
||||
auto active_ss_lst = view_active_search_spaces(cfg().phy().pdcch);
|
||||
|
||||
for (const srsran_search_space_t& ss : active_ss_lst) {
|
||||
// Prioritize UE-dedicated SearchSpaces
|
||||
if (ss.type == srsran_search_space_type_ue and ss.nof_candidates[aggr_idx] > 0 and
|
||||
contains_dci_format(ss, dci_fmt) and is_rnti_type_valid_in_search_space(rnti_type, ss.type)) {
|
||||
return ss.id;
|
||||
}
|
||||
}
|
||||
// Search Common SearchSpaces
|
||||
for (const srsran_search_space_t& ss : active_ss_lst) {
|
||||
if (SRSRAN_SEARCH_SPACE_IS_COMMON(ss.type) and ss.nof_candidates[aggr_idx] > 0 and
|
||||
contains_dci_format(ss, dci_fmt) and is_rnti_type_valid_in_search_space(rnti_type, ss.type)) {
|
||||
return ss.id;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ue_carrier::ue_carrier(uint16_t rnti_,
|
||||
|
|
Loading…
Reference in New Issue