sched,nr: change UE configuration Request struct to better match ORAN specs

master
Francisco 3 years ago committed by Francisco Paisana
parent 6112871da9
commit f1831d9027

@ -42,7 +42,6 @@ using ssb_list = srsran::bounded_vector<ssb_t, mac_interface_phy_nr::M
using sched_args_t = sched_nr_interface::sched_args_t;
using cell_cfg_t = sched_nr_interface::cell_cfg_t;
using bwp_cfg_t = sched_nr_interface::bwp_cfg_t;
using ue_cfg_t = sched_nr_interface::ue_cfg_t;
using ue_cc_cfg_t = sched_nr_interface::ue_cc_cfg_t;
using pdcch_cce_pos_list = srsran::bounded_vector<uint32_t, SRSRAN_SEARCH_SPACE_MAX_NOF_CANDIDATES_NR>;
using bwp_cce_pos_list = std::array<std::array<pdcch_cce_pos_list, MAX_NOF_AGGR_LEVELS>, SRSRAN_NOF_SF_X_FRAME>;
@ -135,68 +134,6 @@ struct sched_params_t {
};
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// 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_t& uecfg_);
uint16_t rnti = SRSRAN_INVALID_RNTI;
uint32_t cc = SRSRAN_MAX_CARRIERS;
const ue_cfg_t& 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_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
} // namespace srsenb

@ -14,10 +14,10 @@
#define SRSRAN_SCHED_NR_INTERFACE_H
#include "srsenb/hdr/stack/mac/common/sched_config.h"
#include "srsran/adt/bounded_bitset.h"
#include "srsran/adt/bounded_vector.h"
#include "srsran/adt/optional.h"
#include "srsran/adt/span.h"
#include "srsran/asn1/rrc_nr.h"
#include "srsran/common/common_nr.h"
#include "srsran/common/phy_cfg_nr.h"
#include "srsran/common/slot_point.h"
@ -40,11 +40,20 @@ struct sched_nr_ue_cc_cfg_t {
uint32_t cc = 0;
};
struct sched_nr_ue_lc_ch_cfg_t {
uint32_t lcid; // 1..32
mac_lc_ch_cfg_t cfg;
};
struct sched_nr_ue_cfg_t {
uint32_t maxharq_tx = 4;
srsran::bounded_vector<sched_nr_ue_cc_cfg_t, SCHED_NR_MAX_CARRIERS> carriers;
std::array<mac_lc_ch_cfg_t, SCHED_NR_MAX_LCID> ue_bearers = {};
srsran::phy_cfg_nr_t phy_cfg = {};
asn1::copy_ptr<asn1::rrc_nr::mac_cell_group_cfg_s> mac_cell_group_cfg;
asn1::copy_ptr<asn1::rrc_nr::phys_cell_group_cfg_s> phy_cell_group_cfg;
asn1::copy_ptr<asn1::rrc_nr::sp_cell_cfg_s> sp_cell_cfg;
std::vector<sched_nr_ue_lc_ch_cfg_t> lc_ch_to_add;
std::vector<uint32_t> lc_ch_to_rem;
};
class sched_nr_interface

@ -15,6 +15,7 @@
#include "srsenb/hdr/stack/mac/sched_common.h"
#include "srsgnb/hdr/stack/mac/sched_nr_cfg.h"
#include "srsgnb/hdr/stack/mac/sched_ue/ue_cfg_manager.h"
#include "srsran/adt/bounded_bitset.h"
#include "srsran/adt/bounded_vector.h"
#include "srsran/phy/common/phy_common_nr.h"

@ -15,6 +15,7 @@
#include "srsenb/hdr/stack/mac/sched_common.h"
#include "srsgnb/hdr/stack/mac/sched_nr_cfg.h"
#include "srsgnb/hdr/stack/mac/sched_ue/ue_cfg_manager.h"
namespace srsenb {

@ -16,6 +16,7 @@
#include "sched_nr_cfg.h"
#include "sched_nr_harq.h"
#include "sched_nr_interface.h"
#include "sched_ue/ue_cfg_manager.h"
#include "srsenb/hdr/stack/mac/common/base_ue_buffer_manager.h"
#include "srsenb/hdr/stack/mac/common/mac_metrics.h"
#include "srsran/adt/circular_map.h"
@ -79,12 +80,12 @@ class ue_carrier
{
public:
ue_carrier(uint16_t rnti,
const ue_cfg_t& cfg,
const ue_cfg_manager& cfg,
const cell_params_t& cell_params_,
const ue_context_common& ctxt,
const ue_buffer_manager::pdu_builder& pdu_builder_);
void set_cfg(const ue_cfg_t& ue_cfg);
void set_cfg(const ue_cfg_manager& ue_cfg);
const ue_carrier_params_t& cfg() const { return bwp_cfg; }
int dl_ack_info(uint32_t pid, uint32_t tb_idx, bool ack);
@ -118,15 +119,15 @@ private:
class ue
{
public:
ue(uint16_t rnti, const ue_cfg_t& cfg, const sched_params_t& sched_cfg_);
ue(uint16_t rnti, const sched_nr_ue_cfg_t& cfg, const sched_params_t& sched_cfg_);
void new_slot(slot_point pdcch_slot);
slot_ue make_slot_ue(slot_point pdcch_slot, uint32_t cc);
/// Update UE CC configuration
void set_cfg(const ue_cfg_t& cfg);
const ue_cfg_t& cfg() const { return ue_cfg; }
void set_cfg(const sched_nr_ue_cfg_t& cfg);
const ue_cfg_manager& cfg() const { return ue_cfg; }
void add_dl_mac_ce(uint32_t ce_lcid, uint32_t nof_cmds = 1);
void rlc_buffer_state(uint32_t lcid, uint32_t newtx, uint32_t retx);
@ -150,7 +151,7 @@ public:
private:
const sched_params_t& sched_cfg;
ue_cfg_t ue_cfg;
ue_cfg_manager ue_cfg;
slot_point last_tx_slot;
slot_point last_sr_slot;

@ -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

@ -10,6 +10,7 @@ set(SOURCES mac_nr.cc
ue_nr.cc
sched_nr.cc
sched_nr_ue.cc
sched_ue/ue_cfg_manager.cc
sched_nr_worker.cc
sched_nr_grant_allocator.cc
sched_nr_harq.cc
@ -25,7 +26,7 @@ set(SOURCES mac_nr.cc
sched_nr_interface_utils.cc)
add_library(srsgnb_mac STATIC ${SOURCES})
target_link_libraries(srsgnb_mac srsenb_mac_common srsran_mac)
target_link_libraries(srsgnb_mac srsenb_mac_common srsran_mac rrc_nr_asn1)
include_directories(${PROJECT_SOURCE_DIR})
add_subdirectory(test)

@ -338,10 +338,6 @@ void mac_nr::rach_detected(const rach_info_t& rach_info)
// Add new user to the scheduler so that it can RX/TX SRB0
sched_nr_ue_cfg_t uecfg = {};
uecfg.carriers.resize(1);
uecfg.carriers[0].active = true;
uecfg.carriers[0].cc = enb_cc_idx;
uecfg.ue_bearers[0].direction = mac_lc_ch_cfg_t::BOTH;
uecfg.phy_cfg = default_ue_phy_cfg;
uint16_t rnti = alloc_ue(enb_cc_idx);

@ -149,47 +149,5 @@ 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_), 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

@ -85,7 +85,7 @@ slot_ue::slot_ue(ue_carrier& ue_, slot_point slot_tx_) : ue(&ue_), pdcch_slot(sl
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ue_carrier::ue_carrier(uint16_t rnti_,
const ue_cfg_t& uecfg_,
const ue_cfg_manager& uecfg_,
const cell_params_t& cell_params_,
const ue_context_common& ctxt,
const ue_buffer_manager::pdu_builder& pdu_builder_) :
@ -99,7 +99,7 @@ ue_carrier::ue_carrier(uint16_t rnti_,
harq_ent(rnti_, cell_params_.nof_prb(), SCHED_NR_MAX_HARQ, cell_params_.bwps[0].logger)
{}
void ue_carrier::set_cfg(const ue_cfg_t& ue_cfg)
void ue_carrier::set_cfg(const ue_cfg_manager& ue_cfg)
{
bwp_cfg = ue_carrier_params_t(rnti, cell_params.bwps[0], ue_cfg);
}
@ -131,15 +131,18 @@ int ue_carrier::ul_crc_info(uint32_t pid, bool crc)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ue::ue(uint16_t rnti_, const ue_cfg_t& cfg, const sched_params_t& sched_cfg_) :
rnti(rnti_), sched_cfg(sched_cfg_), buffers(rnti_, srslog::fetch_basic_logger(sched_cfg_.sched_cfg.logger_name))
ue::ue(uint16_t rnti_, const sched_nr_ue_cfg_t& cfg, const sched_params_t& sched_cfg_) :
rnti(rnti_),
sched_cfg(sched_cfg_),
buffers(rnti_, srslog::fetch_basic_logger(sched_cfg_.sched_cfg.logger_name)),
ue_cfg(0)
{
set_cfg(cfg);
}
void ue::set_cfg(const ue_cfg_t& cfg)
void ue::set_cfg(const sched_nr_ue_cfg_t& cfg)
{
ue_cfg = cfg;
ue_cfg.apply_config_request(cfg);
for (auto& ue_cc_cfg : cfg.carriers) {
if (ue_cc_cfg.active) {
if (carriers[ue_cc_cfg.cc] == nullptr) {
@ -154,7 +157,7 @@ void ue::set_cfg(const ue_cfg_t& cfg)
}
}
buffers.config_lcids(cfg.ue_bearers);
buffers.config_lcids(ue_cfg.ue_bearers);
}
void ue::add_dl_mac_ce(uint32_t ce_lcid, uint32_t nof_cmds)

@ -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

@ -9,13 +9,14 @@
set_directory_properties(PROPERTIES LABELS "sched;nr")
add_library(sched_nr_test_suite sched_nr_common_test.cc sched_nr_ue_ded_test_suite.cc sched_nr_sim_ue.cc)
target_link_libraries(sched_nr_test_suite srsgnb_mac srsran_common)
target_link_libraries(sched_nr_test_suite srsgnb_mac srsran_common rrc_nr_asn1)
add_executable(sched_nr_parallel_test sched_nr_parallel_test.cc)
target_link_libraries(sched_nr_parallel_test
srsgnb_mac
sched_nr_test_suite
srsran_common
rrc_nr_asn1
${CMAKE_THREAD_LIBS_INIT}
${Boost_LIBRARIES})
add_nr_test(sched_nr_parallel_test sched_nr_parallel_test)
@ -24,30 +25,32 @@ add_executable(sched_nr_prb_test sched_nr_prb_test.cc)
target_link_libraries(sched_nr_prb_test
srsgnb_mac
srsran_common
rrc_nr_asn1
${CMAKE_THREAD_LIBS_INIT}
${Boost_LIBRARIES})
add_nr_test(sched_nr_prb_test sched_nr_prb_test)
add_executable(sched_nr_pdcch_test sched_nr_pdcch_test.cc)
target_link_libraries(sched_nr_pdcch_test srsgnb_mac sched_nr_test_suite srsran_common)
target_link_libraries(sched_nr_pdcch_test srsgnb_mac sched_nr_test_suite srsran_common rrc_nr_asn1)
add_nr_test(sched_nr_pdcch_test sched_nr_pdcch_test)
add_executable(sched_nr_sch_test sched_nr_sch_test.cc)
target_link_libraries(sched_nr_sch_test srsgnb_mac sched_nr_test_suite srsran_common)
target_link_libraries(sched_nr_sch_test srsgnb_mac sched_nr_test_suite srsran_common rrc_nr_asn1)
add_nr_test(sched_nr_sch_test sched_nr_sch_test)
add_executable(sched_nr_rar_test sched_nr_rar_test.cc)
target_link_libraries(sched_nr_rar_test srsgnb_mac sched_nr_test_suite srsran_common)
target_link_libraries(sched_nr_rar_test srsgnb_mac sched_nr_test_suite srsran_common rrc_nr_asn1)
add_nr_test(sched_nr_rar_test sched_nr_rar_test)
add_executable(sched_nr_dci_utilities_tests sched_nr_dci_utilities_tests.cc)
target_link_libraries(sched_nr_dci_utilities_tests srsgnb_mac srsran_common)
target_link_libraries(sched_nr_dci_utilities_tests srsgnb_mac srsran_common rrc_nr_asn1)
add_nr_test(sched_nr_dci_utilities_tests sched_nr_dci_utilities_tests)
add_executable(sched_nr_test sched_nr_test.cc)
target_link_libraries(sched_nr_test
srsgnb_mac
sched_nr_test_suite
rrc_nr_asn1
srsran_common ${CMAKE_THREAD_LIBS_INIT}
${Boost_LIBRARIES})
add_nr_test(sched_nr_test sched_nr_test)

@ -89,9 +89,6 @@ inline sched_nr_interface::ue_cfg_t get_rach_ue_cfg(uint32_t
uecfg.carriers[0].active = true;
uecfg.carriers[0].cc = cc;
// set SRB0 as active
uecfg.ue_bearers[0].direction = mac_lc_ch_cfg_t::BOTH;
// set basic PHY config
uecfg.phy_cfg = srsran::phy_cfg_nr_default_t{srsran::phy_cfg_nr_default_t::reference_cfg_t{}};
uecfg.phy_cfg.csi = {};
@ -116,7 +113,6 @@ inline sched_nr_interface::ue_cfg_t get_default_ue_cfg(
uecfg.carriers[cc].active = true;
}
uecfg.phy_cfg = phy_cfg;
uecfg.ue_bearers[0].direction = mac_lc_ch_cfg_t::BOTH;
return uecfg;
}

@ -84,9 +84,11 @@ void run_sched_nr_test(uint32_t nof_workers)
for (uint32_t nof_slots = 0; nof_slots < max_nof_ttis; ++nof_slots) {
slot_point slot_rx(0, nof_slots % 10240);
slot_point slot_tx = slot_rx + TX_ENB_DELAY;
if (slot_rx.to_uint() == 9) {
if (nof_slots == 9) {
sched_nr_interface::ue_cfg_t uecfg = get_default_ue_cfg(nof_sectors);
uecfg.ue_bearers[1].direction = mac_lc_ch_cfg_t::BOTH;
uecfg.lc_ch_to_add.emplace_back();
uecfg.lc_ch_to_add.back().lcid = 1;
uecfg.lc_ch_to_add.back().cfg.direction = mac_lc_ch_cfg_t::BOTH;
tester.add_user(rnti, uecfg, slot_rx, 0);
}
tester.run_slot(slot_tx);

@ -36,7 +36,7 @@ void test_coreset0_cfg()
bwp_params_t bwp_params{cell_cfg, sched_args, 0, 0};
// UE config
ue_cfg_t uecfg = get_rach_ue_cfg(0);
ue_cfg_manager uecfg{get_rach_ue_cfg(0)};
uecfg.phy_cfg.pdcch = cell_cfg.bwps[0].pdcch; // Starts without UE-specific PDCCH
ue_carrier_params_t ue_cc{0x46, bwp_params, uecfg};
@ -149,7 +149,7 @@ void test_coreset2_cfg()
bwp_params_t bwp_params{cell_cfg, sched_args, 0, 0};
// UE config
ue_cfg_t uecfg = get_rach_ue_cfg(0);
ue_cfg_manager uecfg{get_rach_ue_cfg(0)};
uecfg.phy_cfg = get_common_ue_phy_cfg(cell_cfg);
uecfg.phy_cfg.pdcch = cell_cfg.bwps[0].pdcch; // Starts with UE-specific PDCCH
ue_carrier_params_t ue_cc{0x46, bwp_params, uecfg};
@ -243,7 +243,7 @@ void test_invalid_params()
bwp_params_t bwp_params{cell_cfg, sched_args, 0, 0};
// UE config
ue_cfg_t uecfg = get_rach_ue_cfg(0);
ue_cfg_manager uecfg{get_rach_ue_cfg(0)};
uecfg.phy_cfg = get_common_ue_phy_cfg(cell_cfg);
uecfg.phy_cfg.pdcch = cell_cfg.bwps[0].pdcch; // Starts with UE-specific PDCCH
ue_carrier_params_t ue_cc{0x46, bwp_params, uecfg};

@ -34,7 +34,7 @@ sched_nr_interface::cell_cfg_t get_cell_cfg()
sched_nr_interface::ue_cfg_t get_ue_cfg(const sched_nr_interface::cell_cfg_t& cell_cfg)
{
ue_cfg_t uecfg = get_rach_ue_cfg(0);
sched_nr_ue_cfg_t uecfg = get_rach_ue_cfg(0);
uecfg.phy_cfg = get_common_ue_phy_cfg(cell_cfg);
uecfg.phy_cfg.pdcch = cell_cfg.bwps[0].pdcch; // Starts with UE-specific PDCCH
return uecfg;
@ -202,7 +202,7 @@ void test_ue_pdsch()
// Create Cell and UE configs
sched_nr_impl::cell_cfg_t cell_cfg = get_cell_cfg();
sched_nr_impl::ue_cfg_t uecfg = get_ue_cfg(cell_cfg);
sched_nr_impl::ue_cfg_manager uecfg{get_ue_cfg(cell_cfg)};
sched_nr_interface::sched_args_t sched_args;
bwp_params_t bwp_params{cell_cfg, sched_args, 0, 0};
ue_carrier_params_t ue_cc{0x4601, bwp_params, uecfg};
@ -269,7 +269,7 @@ void test_pdsch_fail()
// Create Cell and UE configs
sched_nr_impl::cell_cfg_t cell_cfg = get_cell_cfg();
sched_nr_impl::ue_cfg_t uecfg = get_ue_cfg(cell_cfg);
sched_nr_impl::ue_cfg_manager uecfg{get_ue_cfg(cell_cfg)};
sched_nr_interface::sched_args_t sched_args;
bwp_params_t bwp_params{cell_cfg, sched_args, 0, 0};
ue_carrier_params_t ue_cc{0x4601, bwp_params, uecfg};
@ -318,7 +318,7 @@ void test_multi_pdsch()
// Create Cell and UE configs
sched_nr_impl::cell_cfg_t cell_cfg = get_cell_cfg();
sched_nr_impl::ue_cfg_t uecfg = get_ue_cfg(cell_cfg);
sched_nr_impl::ue_cfg_manager uecfg{get_ue_cfg(cell_cfg)};
sched_nr_interface::sched_args_t sched_args;
bwp_params_t bwp_params{cell_cfg, sched_args, 0, 0};
ue_carrier_params_t ue_cc{0x4601, bwp_params, uecfg};
@ -409,7 +409,7 @@ void test_multi_pusch()
// Create Cell and UE configs
sched_nr_impl::cell_cfg_t cell_cfg = get_cell_cfg();
sched_nr_impl::ue_cfg_t uecfg = get_ue_cfg(cell_cfg);
sched_nr_impl::ue_cfg_manager uecfg{get_ue_cfg(cell_cfg)};
sched_nr_interface::sched_args_t sched_args;
bwp_params_t bwp_params{cell_cfg, sched_args, 0, 0};
ue_carrier_params_t ue_cc{0x4601, bwp_params, uecfg};

@ -19,7 +19,7 @@
namespace srsenb {
sched_nr_ue_sim::sched_nr_ue_sim(uint16_t rnti_,
const sched_nr_interface::ue_cfg_t& ue_cfg_,
const sched_nr_ue_cfg_t& ue_cfg_,
slot_point prach_slot_rx,
uint32_t preamble_idx) :
logger(srslog::fetch_basic_logger("MAC"))
@ -27,7 +27,7 @@ sched_nr_ue_sim::sched_nr_ue_sim(uint16_t rnti_,
ctxt.rnti = rnti_;
ctxt.prach_slot_rx = prach_slot_rx;
ctxt.preamble_idx = preamble_idx;
ctxt.ue_cfg = ue_cfg_;
ctxt.ue_cfg.apply_config_request(ue_cfg_);
ctxt.cc_list.resize(ue_cfg_.carriers.size());
for (auto& cc : ctxt.cc_list) {
@ -229,7 +229,7 @@ void sched_nr_base_test_bench::user_cfg(uint16_t rnti, const sched_nr_interface:
{
TESTASSERT(ue_db.count(rnti) > 0);
ue_db.at(rnti).get_ctxt().ue_cfg = ue_cfg_;
ue_db.at(rnti).get_ctxt().ue_cfg.apply_config_request(ue_cfg_);
sched_ptr->ue_cfg(rnti, ue_cfg_);
}

@ -72,7 +72,7 @@ struct sim_nr_ue_ctxt_t {
uint16_t rnti;
uint32_t preamble_idx;
slot_point prach_slot_rx;
sched_nr_interface::ue_cfg_t ue_cfg;
sched_nr_impl::ue_cfg_manager ue_cfg;
std::vector<ue_nr_cc_ctxt_t> cc_list;
bool is_last_dl_retx(uint32_t ue_cc_idx, uint32_t pid) const
@ -89,10 +89,7 @@ struct sim_nr_enb_ctxt_t {
class sched_nr_ue_sim
{
public:
sched_nr_ue_sim(uint16_t rnti_,
const sched_nr_interface::ue_cfg_t& ue_cfg_,
slot_point prach_slot_rx,
uint32_t preamble_idx);
sched_nr_ue_sim(uint16_t rnti_, const sched_nr_ue_cfg_t& ue_cfg_, slot_point prach_slot_rx, uint32_t preamble_idx);
int update(const sched_nr_cc_result_view& cc_out);

@ -703,7 +703,6 @@ void rrc_nr::sgnb_addition_request(uint16_t eutra_rnti, const sgnb_addition_req_
uecfg.carriers.resize(1);
uecfg.carriers[0].active = true;
uecfg.carriers[0].cc = 0;
uecfg.ue_bearers[0].direction = mac_lc_ch_cfg_t::BOTH;
srsran::phy_cfg_nr_default_t::reference_cfg_t ref_args{};
ref_args.duplex = cfg.cell_list[0].duplex_mode == SRSRAN_DUPLEX_MODE_TDD
? srsran::phy_cfg_nr_default_t::reference_cfg_t::R_DUPLEX_TDD_CUSTOM_6_4

@ -737,13 +737,13 @@ void rrc_nr::ue::crnti_ce_received()
// Add DRB1 to MAC
for (auto& drb : cell_group_cfg.rlc_bearer_to_add_mod_list) {
uecfg.ue_bearers[drb.lc_ch_id].direction = mac_lc_ch_cfg_t::BOTH;
uecfg.ue_bearers[drb.lc_ch_id].group = drb.mac_lc_ch_cfg.ul_specific_params.lc_ch_group;
uecfg.lc_ch_to_add.emplace_back();
uecfg.lc_ch_to_add.back().lcid = drb.lc_ch_id;
uecfg.lc_ch_to_add.back().cfg.direction = mac_lc_ch_cfg_t::BOTH;
uecfg.lc_ch_to_add.back().cfg.group = drb.mac_lc_ch_cfg.ul_specific_params.lc_ch_group;
}
// Update UE phy params
srsran::make_pdsch_cfg_from_serv_cell(cell_group_cfg.sp_cell_cfg.sp_cell_cfg_ded, &uecfg.phy_cfg.pdsch);
srsran::make_csi_cfg_from_serv_cell(cell_group_cfg.sp_cell_cfg.sp_cell_cfg_ded, &uecfg.phy_cfg.csi);
srsran::make_phy_ssb_cfg(parent->cfg.cell_list[0].phy_cell.carrier,
cell_group_cfg.sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common,
&uecfg.phy_cfg.ssb);
@ -751,6 +751,10 @@ void rrc_nr::ue::crnti_ce_received()
&uecfg.phy_cfg.duplex);
srsran_assert(check_nr_pdcch_cfg_valid(uecfg.phy_cfg.pdcch) == SRSRAN_SUCCESS, "Invalid PhyCell Config");
uecfg.sp_cell_cfg.reset(new sp_cell_cfg_s{cell_group_cfg.sp_cell_cfg});
uecfg.mac_cell_group_cfg.reset(new mac_cell_group_cfg_s{cell_group_cfg.mac_cell_group_cfg});
uecfg.phy_cell_group_cfg.reset(new phys_cell_group_cfg_s{cell_group_cfg.phys_cell_group_cfg});
parent->mac->ue_cfg(rnti, uecfg);
}
}
@ -1414,17 +1418,19 @@ int rrc_nr::ue::update_mac(const cell_group_cfg_s& cell_group_config, bool is_co
if (not is_config_complete) {
// Release bearers
for (uint8_t lcid : cell_group_config.rlc_bearer_to_release_list) {
uecfg.ue_bearers[lcid].direction = mac_lc_ch_cfg_t::IDLE;
uecfg.lc_ch_to_rem.push_back(lcid);
}
for (const rlc_bearer_cfg_s& bearer : cell_group_config.rlc_bearer_to_add_mod_list) {
uecfg.ue_bearers[bearer.lc_ch_id].direction = mac_lc_ch_cfg_t::BOTH;
uecfg.lc_ch_to_add.emplace_back();
uecfg.lc_ch_to_add.back().lcid = bearer.lc_ch_id;
auto& lch = uecfg.lc_ch_to_add.back().cfg;
lch.direction = mac_lc_ch_cfg_t::BOTH;
if (bearer.mac_lc_ch_cfg.ul_specific_params_present) {
uecfg.ue_bearers[bearer.lc_ch_id].priority = bearer.mac_lc_ch_cfg.ul_specific_params.prio;
uecfg.ue_bearers[bearer.lc_ch_id].pbr =
bearer.mac_lc_ch_cfg.ul_specific_params.prioritised_bit_rate.to_number();
uecfg.ue_bearers[bearer.lc_ch_id].bsd = bearer.mac_lc_ch_cfg.ul_specific_params.bucket_size_dur.to_number();
uecfg.ue_bearers[bearer.lc_ch_id].group = bearer.mac_lc_ch_cfg.ul_specific_params.lc_ch_group;
lch.priority = bearer.mac_lc_ch_cfg.ul_specific_params.prio;
lch.pbr = bearer.mac_lc_ch_cfg.ul_specific_params.prioritised_bit_rate.to_number();
lch.bsd = bearer.mac_lc_ch_cfg.ul_specific_params.bucket_size_dur.to_number();
lch.group = bearer.mac_lc_ch_cfg.ul_specific_params.lc_ch_group;
// TODO: remaining fields
}
}
@ -1442,10 +1448,11 @@ int rrc_nr::ue::update_mac(const cell_group_cfg_s& cell_group_config, bool is_co
}
}
uecfg.sp_cell_cfg.reset(new sp_cell_cfg_s{cell_group_cfg.sp_cell_cfg});
uecfg.mac_cell_group_cfg.reset(new mac_cell_group_cfg_s{cell_group_cfg.mac_cell_group_cfg});
uecfg.phy_cell_group_cfg.reset(new phys_cell_group_cfg_s{cell_group_cfg.phys_cell_group_cfg});
parent->mac->ue_cfg(rnti, uecfg);
srsran::make_csi_cfg_from_serv_cell(cell_group_config.sp_cell_cfg.sp_cell_cfg_ded, &uecfg.phy_cfg.csi);
return SRSRAN_SUCCESS;
}
@ -1457,11 +1464,14 @@ int rrc_nr::ue::update_mac(const cell_group_cfg_s& cell_group_config, bool is_co
void rrc_nr::ue::deactivate_bearers()
{
// Iterate over the bearers (MAC LC CH) and set each of them to IDLE
for (auto& ue_bearer : uecfg.ue_bearers) {
ue_bearer.direction = mac_lc_ch_cfg_t::IDLE;
for (uint32_t lcid = 0; lcid < SCHED_NR_MAX_LCID; ++lcid) {
uecfg.lc_ch_to_rem.push_back(lcid);
}
// No need to check the returned value, as the function ue_cfg will return SRSRAN_SUCCESS (it asserts if it fails)
uecfg.phy_cell_group_cfg = {};
uecfg.mac_cell_group_cfg = {};
uecfg.sp_cell_cfg = {};
parent->mac->ue_cfg(rnti, uecfg);
}

@ -71,12 +71,10 @@ void test_rrc_nr_connection_establishment(srsran::task_scheduler& task_sched,
TESTASSERT_EQ(srsran::srb_to_lcid(srsran::nr_srb::srb1), srb1.srb_id);
// Test UE context in MAC
TESTASSERT_EQ(rnti, mac.last_ue_cfg_rnti);
// Only LCID=0 and LCID=2 are active
TESTASSERT_EQ(mac_lc_ch_cfg_t::BOTH, mac.last_ue_cfg.ue_bearers[0].direction);
TESTASSERT_EQ(mac_lc_ch_cfg_t::BOTH, mac.last_ue_cfg.ue_bearers[1].direction);
for (uint32_t lcid = 2; lcid < mac.last_ue_cfg.ue_bearers.size(); ++lcid) {
TESTASSERT_EQ(mac_lc_ch_cfg_t::IDLE, mac.last_ue_cfg.ue_bearers[lcid].direction);
}
// Only LCID=1 is added
TESTASSERT_EQ(1, mac.last_ue_cfg.lc_ch_to_add.size());
TESTASSERT_EQ(1, mac.last_ue_cfg.lc_ch_to_add.front().lcid);
TESTASSERT_EQ(mac_lc_ch_cfg_t::BOTH, mac.last_ue_cfg.lc_ch_to_add.front().cfg.direction);
bool found_common_ul_dci_format = false;
for (uint32_t ss_id = 0; ss_id < SRSRAN_UE_DL_NR_MAX_NOF_SEARCH_SPACE; ++ss_id) {
if (mac.last_ue_cfg.phy_cfg.pdcch.search_space_present[ss_id]) {

@ -464,8 +464,10 @@ public:
{
// add UE to scheduler
if (not use_dummy_mac and not wait_preamble) {
srsenb::sched_nr_interface::ue_cfg_t ue_cfg = srsenb::get_default_ue_cfg(1, phy_cfg);
ue_cfg.ue_bearers[4].direction = srsenb::mac_lc_ch_cfg_t::BOTH;
srsenb::sched_nr_ue_cfg_t ue_cfg = srsenb::get_default_ue_cfg(1, phy_cfg);
ue_cfg.lc_ch_to_add.emplace_back();
ue_cfg.lc_ch_to_add.back().lcid = 4;
ue_cfg.lc_ch_to_add.back().cfg.direction = srsenb::mac_lc_ch_cfg_t::BOTH;
mac->reserve_rnti(0, ue_cfg);
}

Loading…
Cancel
Save