sched,nr: ensure the ue_cfg_t passed to the scheduler in NR FDD mode has the correct harq delay

master
Francisco 3 years ago committed by Francisco Paisana
parent 255ddb1329
commit 9df6c6b936

@ -27,6 +27,8 @@
namespace srsenb {
struct sched_nr_ue_cfg_t;
/*****************************
* RLC INTERFACES
****************************/
@ -134,7 +136,7 @@ public:
virtual int read_pdu_bcch_dlsch(uint32_t sib_index, srsran::unique_byte_buffer_t& buffer) = 0;
/// User management
virtual int add_user(uint16_t rnti) = 0;
virtual int add_user(uint16_t rnti, const sched_nr_ue_cfg_t& uecfg) = 0;
virtual int update_user(uint16_t new_rnti, uint16_t old_rnti) = 0;
virtual void set_activity_user(uint16_t rnti) = 0;
};

@ -24,7 +24,7 @@ public:
virtual int cell_cfg(const std::vector<srsenb::sched_nr_interface::cell_cfg_t>& nr_cells) = 0;
/// Allocates a new user/RNTI at MAC. Returns RNTI on success or SRSRAN_INVALID_RNTI otherwise.
virtual uint16_t reserve_rnti(uint32_t enb_cc_idx) = 0;
virtual uint16_t reserve_rnti(uint32_t enb_cc_idx, const sched_nr_interface::ue_cfg_t& uecfg) = 0;
virtual int ue_cfg(uint16_t rnti, const sched_nr_interface::ue_cfg_t& ue_cfg) = 0;

@ -53,7 +53,7 @@ public:
// MAC interface for RRC
int cell_cfg(const std::vector<srsenb::sched_nr_interface::cell_cfg_t>& nr_cells) override;
uint16_t reserve_rnti(uint32_t enb_cc_idx) override;
uint16_t reserve_rnti(uint32_t enb_cc_idx, const sched_nr_interface::ue_cfg_t& uecfg) override;
int read_pdu_bcch_bch(uint8_t* payload);
int ue_cfg(uint16_t rnti, const sched_nr_interface::ue_cfg_t& ue_cfg) override;
int remove_ue(uint16_t rnti) override;

@ -33,6 +33,18 @@ const static size_t SCHED_NR_MAX_BWP_PER_CELL = 2;
const static size_t SCHED_NR_MAX_LCID = 32;
const static size_t SCHED_NR_MAX_LC_GROUP = 7;
struct sched_nr_ue_cc_cfg_t {
bool active = false;
uint32_t cc = 0;
};
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 = {};
};
class sched_nr_interface
{
public:
@ -76,17 +88,8 @@ public:
std::string logger_name = "MAC-NR";
};
struct ue_cc_cfg_t {
bool active = false;
uint32_t cc = 0;
};
struct ue_cfg_t {
uint32_t maxharq_tx = 4;
srsran::bounded_vector<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 = {};
};
using ue_cc_cfg_t = sched_nr_ue_cc_cfg_t;
using ue_cfg_t = sched_nr_ue_cfg_t;
////// RA procedure //////

@ -69,7 +69,7 @@ public:
int read_pdu_bcch_dlsch(uint32_t sib_index, srsran::unique_byte_buffer_t& buffer) final;
/// User manegement
int add_user(uint16_t rnti);
int add_user(uint16_t rnti, const sched_nr_ue_cfg_t& uecfg);
void rem_user(uint16_t rnti);
int update_user(uint16_t new_rnti, uint16_t old_rnti);
void set_activity_user(uint16_t rnti);
@ -104,7 +104,7 @@ public:
class ue
{
public:
ue(rrc_nr* parent_, uint16_t rnti_);
ue(rrc_nr* parent_, uint16_t rnti_, const sched_nr_ue_cfg_t& uecfg);
void send_connection_setup();
void send_dl_ccch(asn1::rrc_nr::dl_ccch_msg_s* dl_dcch_msg);

@ -136,21 +136,13 @@ int mac_nr::ue_cfg(uint16_t rnti, const sched_nr_interface::ue_cfg_t& ue_cfg)
return SRSRAN_SUCCESS;
}
uint16_t mac_nr::reserve_rnti(uint32_t enb_cc_idx)
uint16_t mac_nr::reserve_rnti(uint32_t enb_cc_idx, const sched_nr_ue_cfg_t& uecfg)
{
uint16_t rnti = alloc_ue(enb_cc_idx);
if (rnti == SRSRAN_INVALID_RNTI) {
return rnti;
}
// Add new user to the scheduler so that it can RX/TX SRB0
srsenb::sched_nr_interface::ue_cfg_t uecfg = {};
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;
uecfg.phy_cfg = srsran::phy_cfg_nr_default_t{srsran::phy_cfg_nr_default_t::reference_cfg_t{}};
uecfg.phy_cfg.csi = {}; // disable CSI until RA is complete
sched.ue_cfg(rnti, uecfg);
return rnti;
@ -165,7 +157,21 @@ void mac_nr::rach_detected(const rach_info_t& rach_info)
uint32_t enb_cc_idx = 0;
stack_task_queue.push([this, rach_info, enb_cc_idx, rach_tprof_meas]() mutable {
rach_tprof_meas.defer_stop();
uint16_t rnti = reserve_rnti(enb_cc_idx);
// 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 = 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 = cell_config[0].duplex.mode == SRSRAN_DUPLEX_MODE_TDD
? srsran::phy_cfg_nr_default_t::reference_cfg_t::R_DUPLEX_TDD_CUSTOM_6_4
: srsran::phy_cfg_nr_default_t::reference_cfg_t::R_DUPLEX_FDD;
uecfg.phy_cfg = srsran::phy_cfg_nr_default_t{ref_args};
uecfg.phy_cfg.csi = {}; // disable CSI until RA is complete
uint16_t rnti = reserve_rnti(enb_cc_idx, uecfg);
// Log this event.
++detected_rachs[enb_cc_idx];
@ -178,7 +184,7 @@ void mac_nr::rach_detected(const rach_info_t& rach_info)
rar_info.prach_slot = slot_point{NUMEROLOGY_IDX, rach_info.slot_index};
// TODO: fill remaining fields as required
sched.dl_rach_info(enb_cc_idx, rar_info);
rrc->add_user(rnti);
rrc->add_user(rnti, uecfg);
logger.info("RACH: slot=%d, cc=%d, preamble=%d, offset=%d, temp_crnti=0x%x",
rach_info.slot_index,

@ -145,10 +145,10 @@ rrc_nr_cfg_t rrc_nr::update_default_cfg(const rrc_nr_cfg_t& current)
}
// This function is called from PRACH worker (can wait)
int rrc_nr::add_user(uint16_t rnti)
int rrc_nr::add_user(uint16_t rnti, const sched_nr_ue_cfg_t& uecfg)
{
if (users.count(rnti) == 0) {
users.insert(std::make_pair(rnti, std::unique_ptr<ue>(new ue(this, rnti))));
users.insert(std::make_pair(rnti, std::unique_ptr<ue>(new ue(this, rnti, uecfg))));
rlc->add_user(rnti);
pdcp->add_user(rnti);
logger.info("Added new user rnti=0x%x", rnti);
@ -478,14 +478,26 @@ int rrc_nr::sgnb_addition_request(uint16_t eutra_rnti, const sgnb_addition_req_p
{
task_sched.defer_task([this, eutra_rnti, params]() {
// try to allocate new user
uint16_t nr_rnti = mac->reserve_rnti(0);
sched_nr_ue_cfg_t uecfg{};
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
: srsran::phy_cfg_nr_default_t::reference_cfg_t::R_DUPLEX_FDD;
uecfg.phy_cfg = srsran::phy_cfg_nr_default_t{ref_args};
uecfg.phy_cfg.csi = {}; // disable CSI until RA is complete
uint16_t nr_rnti = mac->reserve_rnti(0, uecfg);
if (nr_rnti == SRSRAN_INVALID_RNTI) {
logger.error("Failed to allocate RNTI at MAC");
rrc_eutra->sgnb_addition_reject(eutra_rnti);
return;
}
if (add_user(nr_rnti) != SRSRAN_SUCCESS) {
if (add_user(nr_rnti, uecfg) != SRSRAN_SUCCESS) {
logger.error("Failed to allocate RNTI at RRC");
rrc_eutra->sgnb_addition_reject(eutra_rnti);
return;
@ -527,7 +539,9 @@ int rrc_nr::sgnb_release_request(uint16_t nr_rnti)
Every function in UE class is called from a mutex environment thus does not
need extra protection.
*******************************************************************************/
rrc_nr::ue::ue(rrc_nr* parent_, uint16_t rnti_) : parent(parent_), rnti(rnti_), uecfg(srsenb::get_rach_ue_cfg(0)) {}
rrc_nr::ue::ue(rrc_nr* parent_, uint16_t rnti_, const sched_nr_ue_cfg_t& uecfg_) :
parent(parent_), rnti(rnti_), uecfg(uecfg_)
{}
void rrc_nr::ue::send_connection_setup()
{

@ -23,7 +23,7 @@ class rrc_nr_dummy : public rrc_interface_mac_nr
public:
int read_pdu_bcch_bch(const uint32_t tti, srsran::unique_byte_buffer_t& buffer) { return SRSRAN_SUCCESS; }
int read_pdu_bcch_dlsch(uint32_t sib_index, srsran::unique_byte_buffer_t& buffer) { return SRSRAN_SUCCESS; }
int add_user(uint16_t rnti) { return SRSRAN_SUCCESS; }
int add_user(uint16_t rnti, const sched_nr_ue_cfg_t& uecfg) { return SRSRAN_SUCCESS; }
int update_user(uint16_t new_rnti, uint16_t old_rnti) { return SRSRAN_SUCCESS; }
void set_activity_user(uint16_t rnti) {}
};
@ -40,7 +40,7 @@ class mac_nr_dummy : public mac_interface_rrc_nr
{
public:
int cell_cfg(const std::vector<srsenb::sched_nr_interface::cell_cfg_t>& nr_cells) override { return SRSRAN_SUCCESS; }
uint16_t reserve_rnti(uint32_t enb_cc_idx) override { return 0x4601; }
uint16_t reserve_rnti(uint32_t enb_cc_idx, const sched_nr_ue_cfg_t& uecfg) override { return 0x4601; }
int ue_cfg(uint16_t rnti, const sched_nr_interface::ue_cfg_t& ue_cfg) override { return SRSRAN_SUCCESS; }

@ -374,11 +374,10 @@ public:
// add UE to scheduler
if (not use_dummy_mac and not args.wait_preamble) {
mac->reserve_rnti(0);
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;
mac->ue_cfg(args.rnti, ue_cfg);
mac->reserve_rnti(0, ue_cfg);
}
dl.mcs = args.pdsch.mcs;

Loading…
Cancel
Save