mirror of https://github.com/pvnis/srsRAN_4G.git
sched,nr: change UE configuration Request struct to better match ORAN specs
parent
6112871da9
commit
f1831d9027
@ -0,0 +1,98 @@
|
||||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set
|
||||
* forth in the LICENSE file which can be found at the top level of
|
||||
* the distribution.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SRSRAN_UE_CFG_MANAGER_H
|
||||
#define SRSRAN_UE_CFG_MANAGER_H
|
||||
|
||||
#include "../sched_nr_cfg.h"
|
||||
|
||||
namespace srsenb {
|
||||
namespace sched_nr_impl {
|
||||
|
||||
using ue_cc_cfg_list = srsran::bounded_vector<sched_nr_ue_cc_cfg_t, SCHED_NR_MAX_CARRIERS>;
|
||||
|
||||
struct ue_cfg_manager {
|
||||
uint32_t maxharq_tx = 4;
|
||||
ue_cc_cfg_list carriers;
|
||||
std::array<mac_lc_ch_cfg_t, SCHED_NR_MAX_LCID> ue_bearers = {};
|
||||
srsran::phy_cfg_nr_t phy_cfg = {};
|
||||
|
||||
explicit ue_cfg_manager(uint32_t enb_cc_idx = 0);
|
||||
explicit ue_cfg_manager(const sched_nr_ue_cfg_t& cfg_req);
|
||||
int apply_config_request(const sched_nr_ue_cfg_t& cfg_req);
|
||||
};
|
||||
|
||||
/// Semi-static configuration of a UE for a given CC.
|
||||
class ue_carrier_params_t
|
||||
{
|
||||
public:
|
||||
ue_carrier_params_t() = default;
|
||||
explicit ue_carrier_params_t(uint16_t rnti, const bwp_params_t& active_bwp_cfg, const ue_cfg_manager& uecfg_);
|
||||
|
||||
uint16_t rnti = SRSRAN_INVALID_RNTI;
|
||||
uint32_t cc = SRSRAN_MAX_CARRIERS;
|
||||
|
||||
const ue_cfg_manager& ue_cfg() const { return *cfg_; }
|
||||
const srsran::phy_cfg_nr_t& phy() const { return cfg_->phy_cfg; }
|
||||
const bwp_params_t& active_bwp() const { return *bwp_cfg; }
|
||||
|
||||
/// Get SearchSpace based on SearchSpaceId
|
||||
const srsran_search_space_t* get_ss(uint32_t ss_id) const
|
||||
{
|
||||
if (phy().pdcch.search_space_present[ss_id]) {
|
||||
// UE-dedicated SearchSpace
|
||||
return &bwp_cfg->cfg.pdcch.search_space[ss_id];
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
srsran::const_span<uint32_t> cce_pos_list(uint32_t search_id, uint32_t slot_idx, uint32_t aggr_idx) const
|
||||
{
|
||||
if (cce_positions_list.size() > ss_id_to_cce_idx[search_id]) {
|
||||
auto& lst = cce_pos_list(search_id);
|
||||
return lst[slot_idx][aggr_idx];
|
||||
}
|
||||
return srsran::const_span<uint32_t>{};
|
||||
}
|
||||
const bwp_cce_pos_list& cce_pos_list(uint32_t search_id) const
|
||||
{
|
||||
return cce_positions_list[ss_id_to_cce_idx[search_id]];
|
||||
}
|
||||
|
||||
uint32_t get_k1(slot_point pdsch_slot) const
|
||||
{
|
||||
if (phy().duplex.mode == SRSRAN_DUPLEX_MODE_TDD) {
|
||||
return phy().harq_ack.dl_data_to_ul_ack[pdsch_slot.to_uint() % phy().duplex.tdd.pattern1.period_ms];
|
||||
}
|
||||
return phy().harq_ack.dl_data_to_ul_ack[pdsch_slot.to_uint() % phy().harq_ack.nof_dl_data_to_ul_ack];
|
||||
}
|
||||
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; }
|
||||
|
||||
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_manager* 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
|
||||
} // namespace srsenb
|
||||
|
||||
#endif // SRSRAN_UE_CFG_MANAGER_H
|
@ -0,0 +1,99 @@
|
||||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set
|
||||
* forth in the LICENSE file which can be found at the top level of
|
||||
* the distribution.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "srsgnb/hdr/stack/mac/sched_ue/ue_cfg_manager.h"
|
||||
#include "srsgnb/hdr/stack/mac/sched_nr_helpers.h"
|
||||
#include "srsran/asn1/rrc_nr_utils.h"
|
||||
|
||||
namespace srsenb {
|
||||
namespace sched_nr_impl {
|
||||
|
||||
ue_cfg_manager::ue_cfg_manager(uint32_t enb_cc_idx) : carriers(1)
|
||||
{
|
||||
carriers[enb_cc_idx].active = true;
|
||||
carriers[enb_cc_idx].cc = enb_cc_idx;
|
||||
ue_bearers[0].direction = mac_lc_ch_cfg_t::BOTH;
|
||||
}
|
||||
|
||||
ue_cfg_manager::ue_cfg_manager(const sched_nr_ue_cfg_t& cfg_req) : ue_cfg_manager()
|
||||
{
|
||||
apply_config_request(cfg_req);
|
||||
}
|
||||
|
||||
int ue_cfg_manager::apply_config_request(const sched_nr_ue_cfg_t& cfg_req)
|
||||
{
|
||||
maxharq_tx = cfg_req.maxharq_tx;
|
||||
carriers = cfg_req.carriers;
|
||||
phy_cfg = cfg_req.phy_cfg;
|
||||
|
||||
if (cfg_req.sp_cell_cfg.is_present()) {
|
||||
srsran::make_pdsch_cfg_from_serv_cell(cfg_req.sp_cell_cfg->sp_cell_cfg_ded, &phy_cfg.pdsch);
|
||||
srsran::make_csi_cfg_from_serv_cell(cfg_req.sp_cell_cfg->sp_cell_cfg_ded, &phy_cfg.csi);
|
||||
}
|
||||
for (uint32_t lcid : cfg_req.lc_ch_to_rem) {
|
||||
assert(lcid > 0 && "LCID=0 cannot be removed");
|
||||
ue_bearers[lcid] = {};
|
||||
}
|
||||
for (const sched_nr_ue_lc_ch_cfg_t& lc_ch : cfg_req.lc_ch_to_add) {
|
||||
assert(lc_ch.lcid > 0 && "LCID=0 cannot be configured");
|
||||
ue_bearers[lc_ch.lcid] = lc_ch.cfg;
|
||||
}
|
||||
|
||||
return SRSRAN_SUCCESS;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ue_carrier_params_t::ue_carrier_params_t(uint16_t rnti_, const bwp_params_t& bwp_cfg_, const ue_cfg_manager& uecfg_) :
|
||||
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;
|
||||
auto ss_view = srsran::make_optional_span(pdcch.search_space, pdcch.search_space_present);
|
||||
auto coreset_view = srsran::make_optional_span(pdcch.coreset, pdcch.coreset_present);
|
||||
for (const auto& ss : ss_view) {
|
||||
srsran_assert(coreset_view.contains(ss.coreset_id),
|
||||
"Invalid mapping search space id=%d to coreset id=%d",
|
||||
ss.id,
|
||||
ss.coreset_id);
|
||||
cce_positions_list.emplace_back();
|
||||
get_dci_locs(coreset_view[ss.coreset_id], ss, rnti, cce_positions_list.back());
|
||||
ss_id_to_cce_idx[ss.id] = cce_positions_list.size() - 1;
|
||||
}
|
||||
}
|
||||
|
||||
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
|
Loading…
Reference in New Issue