changed the sched::ue_cfg(...) function to allow diff configurations. The RRC now activates all carriers after rrc reconf complete

master
Francisco Paisana 5 years ago
parent b66bc3a6b0
commit 5f557700f2

@ -250,11 +250,11 @@ class rrc_interface_mac
{
public:
/* Radio Link failure */
virtual void rl_failure(uint16_t rnti) = 0;
virtual void add_user(uint16_t rnti) = 0;
virtual void upd_user(uint16_t new_rnti, uint16_t old_rnti) = 0;
virtual void set_activity_user(uint16_t rnti) = 0;
virtual bool is_paging_opportunity(uint32_t tti, uint32_t* payload_len) = 0;
virtual void rl_failure(uint16_t rnti) = 0;
virtual void add_user(uint16_t rnti, const sched_interface::ue_cfg_t& init_ue_cfg) = 0;
virtual void upd_user(uint16_t new_rnti, uint16_t old_rnti) = 0;
virtual void set_activity_user(uint16_t rnti) = 0;
virtual bool is_paging_opportunity(uint32_t tti, uint32_t* payload_len) = 0;
};
// RRC interface for PDCP

@ -101,13 +101,13 @@ public:
std::vector<scell_cfg_t> scell_list;
};
typedef struct {
struct ue_bearer_cfg_t {
int priority;
int bsd;
int pbr;
int group;
enum { IDLE = 0, UL, DL, BOTH } direction;
} ue_bearer_cfg_t;
enum { IDLE = 0, UL, DL, BOTH } direction = IDLE;
};
struct ant_info_ded_t {
enum class tx_mode_t { tm1, tm2, tm3, tm4, tm5, tm6, tm7, tm8_v920, nulltype } tx_mode;
@ -128,14 +128,14 @@ public:
struct ue_cfg_t {
/* ue capabilities, etc */
uint32_t maxharq_tx;
bool continuous_pusch;
srslte_uci_offset_cfg_t uci_offset;
srslte_pucch_cfg_t pucch_cfg;
uint32_t aperiodic_cqi_period; // if 0 is periodic CQI
srslte_dl_cfg_t dl_cfg;
ue_bearer_cfg_t ue_bearers[MAX_LC];
std::vector<uint32_t> supported_cc_idxs;
uint32_t maxharq_tx = 5;
bool continuous_pusch;
srslte_uci_offset_cfg_t uci_offset;
srslte_pucch_cfg_t pucch_cfg = {};
uint32_t aperiodic_cqi_period = 0; // if 0 is periodic CQI
srslte_dl_cfg_t dl_cfg;
std::array<ue_bearer_cfg_t, MAX_LC> ue_bearers = {};
std::vector<uint32_t> supported_cc_idxs;
};
typedef struct {
@ -234,9 +234,9 @@ public:
virtual int reset() = 0;
/* Manages UE scheduling context */
virtual int ue_cfg(uint16_t rnti, ue_cfg_t* cfg) = 0;
virtual int ue_rem(uint16_t rnti) = 0;
virtual bool ue_exists(uint16_t rnti) = 0;
virtual int ue_cfg(uint16_t rnti, const ue_cfg_t& cfg) = 0;
virtual int ue_rem(uint16_t rnti) = 0;
virtual bool ue_exists(uint16_t rnti) = 0;
/* Manages UE bearers and associated configuration */
virtual int bearer_ue_cfg(uint16_t rnti, uint32_t lc_id, ue_bearer_cfg_t* cfg) = 0;

@ -128,7 +128,7 @@ public:
void set_sched_cfg(sched_args_t* sched_cfg);
int reset() final;
int ue_cfg(uint16_t rnti, ue_cfg_t* ue_cfg) final;
int ue_cfg(uint16_t rnti, const ue_cfg_t& ue_cfg) final;
int ue_rem(uint16_t rnti) final;
bool ue_exists(uint16_t rnti) final;
void ue_needs_ta_cmd(uint16_t rnti, uint32_t nof_ta_cmd);

@ -57,7 +57,8 @@ public:
class harq_proc
{
public:
void config(uint32_t id, uint32_t max_retx, srslte::log* log_h);
void init(uint32_t id);
void set_cfg(uint32_t max_retx);
void reset(uint32_t tb_idx);
uint32_t get_id() const;
bool is_empty() const;
@ -78,18 +79,18 @@ protected:
enum ack_t { NULL_ACK, NACK, ACK };
ack_t ack_state[SRSLTE_MAX_TB];
bool active[SRSLTE_MAX_TB];
bool ndi[SRSLTE_MAX_TB];
uint32_t id;
uint32_t max_retx;
uint32_t n_rtx[SRSLTE_MAX_TB];
uint32_t tx_cnt[SRSLTE_MAX_TB];
int tti;
int last_mcs[SRSLTE_MAX_TB];
int last_tbs[SRSLTE_MAX_TB];
srslte::log* log_h;
ack_t ack_state[SRSLTE_MAX_TB];
bool active[SRSLTE_MAX_TB];
std::array<bool, SRSLTE_MAX_TB> ndi = {};
uint32_t id;
uint32_t max_retx = 5;
uint32_t n_rtx[SRSLTE_MAX_TB];
uint32_t tx_cnt[SRSLTE_MAX_TB];
int tti;
int last_mcs[SRSLTE_MAX_TB];
int last_tbs[SRSLTE_MAX_TB];
srslte::log* log_h = nullptr;
};
typedef srslte::bounded_bitset<25, true> rbgmask_t;

@ -43,8 +43,9 @@ struct sched_dci_cce_t {
struct sched_ue_carrier {
const static int SCHED_MAX_HARQ_PROC = SRSLTE_FDD_NOF_HARQ;
sched_ue_carrier(sched_interface::ue_cfg_t* cfg_, const sched_cell_params_t& cell_cfg_, uint16_t rnti_);
sched_ue_carrier(const sched_interface::ue_cfg_t& cfg_, const sched_cell_params_t& cell_cfg_, uint16_t rnti_);
void reset();
void set_cfg(const sched_interface::ue_cfg_t& cfg); ///< reconfigure ue carrier
// Harq access
void reset_old_pending_pids(uint32_t tti_rx);
@ -81,10 +82,10 @@ struct sched_ue_carrier {
std::array<std::array<sched_dci_cce_t, 10>, 3> dci_locations = {};
private:
srslte::log* log_h = nullptr;
sched_interface::ue_cfg_t* cfg = nullptr;
const sched_cell_params_t* cell_params = nullptr;
uint16_t rnti;
srslte::log* log_h = nullptr;
const sched_interface::ue_cfg_t* cfg = nullptr;
const sched_cell_params_t* cell_params = nullptr;
uint16_t rnti;
};
/** This class is designed to be thread-safe because it is called from workers through scheduler thread and from
@ -129,9 +130,6 @@ public:
void tpc_inc();
void tpc_dec();
void set_max_mcs(int mcs_ul, int mcs_dl, int max_aggr_level = -1);
void set_fixed_mcs(int mcs_ul, int mcs_dl);
dl_harq_proc* find_dl_harq(uint32_t tti_rx, uint32_t cc_idx);
dl_harq_proc* get_dl_harq(uint32_t idx, uint32_t cc_idx);
uint16_t get_rnti() const { return rnti; }
@ -214,12 +212,14 @@ public:
uint32_t* mcs);
private:
typedef struct {
sched_interface::ue_bearer_cfg_t cfg;
int buf_tx;
int buf_retx;
int bsr;
} ue_bearer_t;
struct ue_bearer_t {
sched_interface::ue_bearer_cfg_t cfg = {};
int buf_tx = 0;
int buf_retx = 0;
int bsr = 0;
};
void set_bearer_cfg_unlocked(uint32_t lc_id, const sched_interface::ue_bearer_cfg_t& cfg_);
bool is_sr_triggered();
int alloc_pdu(int tbs, sched_interface::dl_sched_pdu_t* pdu);
@ -267,7 +267,6 @@ private:
uint32_t max_msg3retx = 0;
/* User State */
bool configured = false;
bool conres_ce_pending = true;
uint32_t nof_ta_cmd = 0;
@ -275,11 +274,11 @@ private:
int next_tpc_pusch = 0;
int next_tpc_pucch = 0;
bool phy_config_dedicated_enabled = false;
sched_interface::ant_info_ded_t dl_ant_info;
bool phy_config_dedicated_enabled = false;
std::vector<sched_ue_carrier> carriers; ///< map of UE CellIndex to carrier configuration
std::map<uint32_t, uint32_t> enb_ue_cellindex_map; ///< map cc idx eNB -> UE
sched_interface::ant_info_ded_t dl_ant_info;
std::vector<sched_ue_carrier> carriers; ///< map of UE CellIndex to carrier configuration
std::map<uint32_t, uint32_t> enb_ue_cellindex_map; ///< map cc idx eNB -> UE
};
} // namespace srsenb

@ -164,7 +164,7 @@ public:
// rrc_interface_mac
void rl_failure(uint16_t rnti) override;
void add_user(uint16_t rnti) override;
void add_user(uint16_t rnti, const sched_interface::ue_cfg_t& init_ue_cfg) override;
void upd_user(uint16_t new_rnti, uint16_t old_rnti) override;
void set_activity_user(uint16_t rnti) override;
bool is_paging_opportunity(uint32_t tti, uint32_t* payload_len) override;
@ -203,7 +203,7 @@ public:
public:
class rrc_mobility;
ue(rrc* outer_rrc, uint16_t rnti);
ue(rrc* outer_rrc, uint16_t rnti, const sched_interface::ue_cfg_t& ue_cfg);
bool is_connected();
bool is_idle();
@ -300,9 +300,11 @@ public:
uint32_t m_tmsi = 0;
uint8_t mmec = 0;
uint32_t rlf_cnt = 0;
uint8_t transaction_id = 0;
rrc_state_t state = RRC_STATE_IDLE;
// state
sched_interface::ue_cfg_t current_sched_ue_cfg;
uint32_t rlf_cnt = 0;
uint8_t transaction_id = 0;
rrc_state_t state = RRC_STATE_IDLE;
std::map<uint32_t, asn1::rrc::srb_to_add_mod_s> srbs;
std::map<uint32_t, asn1::rrc::drb_to_add_mod_s> drbs;

@ -214,7 +214,7 @@ int mac::ue_cfg(uint16_t rnti, sched_interface::ue_cfg_t* cfg)
}
// Update Scheduler configuration
if ((cfg != nullptr) ? (scheduler.ue_cfg(rnti, cfg) != SRSLTE_SUCCESS) : false) {
if ((cfg != nullptr) ? (scheduler.ue_cfg(rnti, *cfg) != SRSLTE_SUCCESS) : false) {
Error("Registering new UE rnti=0x%x to SCHED\n", rnti);
} else {
ret = 0;
@ -487,13 +487,13 @@ int mac::rach_detected(uint32_t tti, uint32_t enb_cc_idx, uint32_t preamble_idx,
ue_cfg.supported_cc_idxs.push_back(enb_cc_idx);
ue_cfg.ue_bearers[0].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.dl_cfg.tm = SRSLTE_TM1;
if (scheduler.ue_cfg(rnti, &ue_cfg) != SRSLTE_SUCCESS) {
if (scheduler.ue_cfg(rnti, ue_cfg) != SRSLTE_SUCCESS) {
Error("Registering new user rnti=0x%x to SCHED\n", rnti);
return -1;
}
// Register new user in RRC
rrc_h->add_user(rnti);
rrc_h->add_user(rnti, ue_cfg);
// Add temporal rnti to the PHY
if (phy_h->add_rnti(rnti, true)) {
@ -856,7 +856,7 @@ void mac::write_mcch(sib_type2_s* sib2_, sib_type13_r9_s* sib13_, mcch_msg_s* mc
current_mcch_length = current_mcch_length + rlc_header_len;
ue_db[SRSLTE_MRNTI] = new ue(SRSLTE_MRNTI, cell.nof_prb, &scheduler, rrc_h, rlc_h, log_h);
rrc_h->add_user(SRSLTE_MRNTI);
rrc_h->add_user(SRSLTE_MRNTI, {});
}
} // namespace srsenb

@ -200,7 +200,7 @@ int sched::cell_cfg(const std::vector<sched_interface::cell_cfg_t>& cell_cfg)
*
*******************************************************/
int sched::ue_cfg(uint16_t rnti, sched_interface::ue_cfg_t* ue_cfg)
int sched::ue_cfg(uint16_t rnti, const sched_interface::ue_cfg_t& ue_cfg)
{
// Add or config user
pthread_rwlock_rdlock(&rwlock);
@ -213,7 +213,7 @@ int sched::ue_cfg(uint16_t rnti, sched_interface::ue_cfg_t* ue_cfg)
it = ue_db.find(rnti);
pthread_rwlock_rdlock(&rwlock);
}
it->second.set_cfg(*ue_cfg);
it->second.set_cfg(ue_cfg);
pthread_rwlock_unlock(&rwlock);
return 0;

@ -57,14 +57,15 @@ prb_range_t prb_range_t::riv_to_prbs(uint32_t riv, uint32_t nof_prbs, int nof_vr
*
******************************************************/
void harq_proc::config(uint32_t id_, uint32_t max_retx_, srslte::log* log_h_)
void harq_proc::init(uint32_t id_)
{
log_h = srslte::logmap::get("MAC ");
id = id_;
}
void harq_proc::set_cfg(uint32_t max_retx_)
{
log_h = log_h_;
id = id_;
max_retx = max_retx_;
for (int i = 0; i < SRSLTE_MAX_TB; i++) {
ndi[i] = false;
}
}
void harq_proc::reset(uint32_t tb_idx)

@ -49,13 +49,8 @@ constexpr uint32_t conres_ce_size = 6;
*
*******************************************************/
sched_ue::sched_ue()
sched_ue::sched_ue() : log_h(srslte::logmap::get("MAC "))
{
log_h = srslte::logmap::get("MAC ");
bzero(&cell, sizeof(cell));
bzero(&lch, sizeof(lch));
reset();
}
@ -72,50 +67,46 @@ void sched_ue::init(uint16_t rnti_, const std::vector<sched_cell_params_t>& cell
void sched_ue::set_cfg(const sched_interface::ue_cfg_t& cfg_)
{
{
std::lock_guard<std::mutex> lock(mutex);
// calculate diffs and update
std::unique_lock<std::mutex> lock(mutex);
// store previous supported cc idxs
std::vector<uint32_t> prev_cc_idxs(std::move(cfg.supported_cc_idxs));
cfg = cfg_;
// if no list of supported cc idxs is provided, we keep the previous one
// for the first configured cc, set it as primary cc
if (cfg.supported_cc_idxs.empty()) {
if (prev_cc_idxs.empty()) {
Warning("SCHED: Primary cc idx was not set for user rnti=0x%x. Defaulting to first cc.\n", rnti);
cfg.supported_cc_idxs.push_back(0);
uint32_t primary_cc_idx = 0;
if (not cfg_.supported_cc_idxs.empty()) {
primary_cc_idx = cfg_.supported_cc_idxs[0];
} else {
cfg.supported_cc_idxs = prev_cc_idxs;
Warning("Primary cc idx not provided in scheduler ue_cfg. Defaulting to cc_idx=0\n");
}
}
// if primary cc has changed
if (prev_cc_idxs.empty() or prev_cc_idxs[0] != cfg.supported_cc_idxs[0]) {
main_cc_params = &(*cell_params_list)[cfg.supported_cc_idxs[0]];
// setup primary cc
main_cc_params = &(*cell_params_list)[primary_cc_idx];
cell = main_cc_params->cfg.cell;
max_msg3retx = main_cc_params->cfg.maxharq_msg3tx;
}
bool maxharq_tx_changed = cfg.maxharq_tx != cfg_.maxharq_tx;
// setup sched_ue carriers
carriers.clear();
enb_ue_cellindex_map.clear();
for (uint32_t i = 0; i < cfg.supported_cc_idxs.size(); ++i) {
carriers.emplace_back(&cfg, (*cell_params_list)[cfg.supported_cc_idxs[i]], rnti);
enb_ue_cellindex_map[cfg.supported_cc_idxs[i]] = i;
// update configuration
cfg = cfg_;
// update bearer cfgs
for (uint32_t i = 0; i < sched_interface::MAX_LC; ++i) {
set_bearer_cfg_unlocked(i, cfg.ue_bearers[i]);
}
}
for (int i = 0; i < sched_interface::MAX_LC; i++) {
set_bearer_cfg(i, &cfg.ue_bearers[i]);
// either add a new carrier, or reconfigure existing one
for (uint32_t enb_cc_idx : cfg.supported_cc_idxs) {
auto it = enb_ue_cellindex_map.find(enb_cc_idx);
if (it == enb_ue_cellindex_map.end()) {
// add new carrier to sched_ue
carriers.emplace_back(cfg, (*cell_params_list)[enb_cc_idx], rnti);
enb_ue_cellindex_map[enb_cc_idx] = carriers.size() - 1; // maps enb_cc_idx to ue_cc_idx
} else {
// reconfiguration of carrier might be needed
if (maxharq_tx_changed) {
carriers[it->second].set_cfg(cfg);
}
}
}
}
set_max_mcs(main_cc_params->sched_cfg->pusch_max_mcs,
main_cc_params->sched_cfg->pdsch_max_mcs,
main_cc_params->sched_cfg->max_aggr_level);
set_fixed_mcs(main_cc_params->sched_cfg->pusch_mcs, main_cc_params->sched_cfg->pdsch_mcs);
configured = true;
}
void sched_ue::reset()
@ -133,32 +124,11 @@ void sched_ue::reset()
conres_ce_pending = true;
carriers.clear();
enb_ue_cellindex_map.clear();
}
for (int i = 0; i < sched_interface::MAX_LC; i++) {
rem_bearer(i);
}
}
void sched_ue::set_fixed_mcs(int mcs_ul, int mcs_dl)
{
std::lock_guard<std::mutex> lock(mutex);
for (auto& c : carriers) {
c.fixed_mcs_dl = mcs_dl;
c.fixed_mcs_ul = mcs_ul;
}
}
void sched_ue::set_max_mcs(int mcs_ul, int mcs_dl, int max_aggr_level_)
{
std::lock_guard<std::mutex> lock(mutex);
uint32_t max_mcs_ul = mcs_ul >= 0 ? mcs_ul : 28;
uint32_t max_mcs_dl = mcs_dl >= 0 ? mcs_dl : 28;
uint32_t max_aggr_level = max_aggr_level_ >= 0 ? max_aggr_level_ : 3;
for (auto& c : carriers) {
c.max_mcs_dl = max_mcs_dl;
c.max_mcs_ul = max_mcs_ul;
c.max_aggr_level = max_aggr_level;
// erase all bearers
for (uint32_t i = 0; i < cfg.ue_bearers.size(); ++i) {
set_bearer_cfg_unlocked(i, {});
}
}
}
@ -171,20 +141,13 @@ void sched_ue::set_max_mcs(int mcs_ul, int mcs_dl, int max_aggr_level_)
void sched_ue::set_bearer_cfg(uint32_t lc_id, sched_interface::ue_bearer_cfg_t* cfg_)
{
std::lock_guard<std::mutex> lock(mutex);
if (lc_id < sched_interface::MAX_LC) {
memcpy(&lch[lc_id].cfg, cfg_, sizeof(sched_interface::ue_bearer_cfg_t));
if (lch[lc_id].cfg.direction != sched_interface::ue_bearer_cfg_t::IDLE) {
Info("SCHED: Set bearer config lc_id=%d, direction=%d\n", lc_id, (int)lch[lc_id].cfg.direction);
}
}
set_bearer_cfg_unlocked(lc_id, *cfg_);
}
void sched_ue::rem_bearer(uint32_t lc_id)
{
std::lock_guard<std::mutex> lock(mutex);
if (lc_id < sched_interface::MAX_LC) {
bzero(&lch[lc_id], sizeof(ue_bearer_t));
}
set_bearer_cfg_unlocked(lc_id, sched_interface::ue_bearer_cfg_t{});
}
void sched_ue::phy_config_enabled(uint32_t tti, bool enabled)
@ -249,13 +212,11 @@ bool sched_ue::pucch_sr_collision(uint32_t current_tti, uint32_t n_cce)
{
if (!phy_config_dedicated_enabled) {
return false;
} else {
if (cfg.pucch_cfg.sr_configured && srslte_ue_ul_sr_send_tti(&cfg.pucch_cfg, current_tti)) {
return (n_cce + cfg.pucch_cfg.N_pucch_1) == cfg.pucch_cfg.n_pucch_sr;
} else {
return false;
}
}
if (cfg.pucch_cfg.sr_configured && srslte_ue_ul_sr_send_tti(&cfg.pucch_cfg, current_tti)) {
return (n_cce + cfg.pucch_cfg.N_pucch_1) == cfg.pucch_cfg.n_pucch_sr;
}
return false;
}
bool sched_ue::get_pucch_sched(uint32_t current_tti, uint32_t cc_idx, uint32_t prb_idx[2])
@ -913,6 +874,19 @@ uint32_t sched_ue::get_required_prb_ul(uint32_t cc_idx, uint32_t req_bytes)
return carriers[cc_idx].get_required_prb_ul(req_bytes);
}
void sched_ue::set_bearer_cfg_unlocked(uint32_t lc_id, const sched_interface::ue_bearer_cfg_t& cfg_)
{
if (lc_id < sched_interface::MAX_LC) {
bool is_idle = lch[lc_id].cfg.direction == sched_interface::ue_bearer_cfg_t::IDLE;
lch[lc_id].cfg = cfg_;
if (lch[lc_id].cfg.direction != sched_interface::ue_bearer_cfg_t::IDLE) {
Info("SCHED: Set bearer config lc_id=%d, direction=%d\n", lc_id, (int)lch[lc_id].cfg.direction);
} else if (not is_idle) {
Info("SCHED: Removed bearer config lc_id=%d, direction=%d\n", lc_id, (int)lch[lc_id].cfg.direction);
}
}
}
bool sched_ue::is_sr_triggered()
{
return sr;
@ -1093,26 +1067,36 @@ int sched_ue::cqi_to_tbs(uint32_t cqi,
* sched_ue::sched_ue_carrier
***********************************************************************************************/
sched_ue_carrier::sched_ue_carrier(sched_interface::ue_cfg_t* cfg_,
const sched_cell_params_t& cell_cfg_,
uint16_t rnti_) :
cfg(cfg_),
sched_ue_carrier::sched_ue_carrier(const sched_interface::ue_cfg_t& cfg_,
const sched_cell_params_t& cell_cfg_,
uint16_t rnti_) :
cell_params(&cell_cfg_),
rnti(rnti_),
log_h(srslte::logmap::get("MAC "))
{
// Config HARQ processes
// Init HARQ processes
for (uint32_t i = 0; i < dl_harq.size(); ++i) {
dl_harq[i].config(i, cfg->maxharq_tx, log_h);
ul_harq[i].config(i, cfg->maxharq_tx, log_h);
dl_harq[i].init(i);
ul_harq[i].init(i);
}
// set max mcs
max_mcs_ul = cell_params->sched_cfg->pusch_max_mcs >= 0 ? cell_params->sched_cfg->pusch_max_mcs : 28;
max_mcs_dl = cell_params->sched_cfg->pdsch_max_mcs >= 0 ? cell_params->sched_cfg->pdsch_max_mcs : 28;
max_aggr_level = cell_params->sched_cfg->max_aggr_level >= 0 ? cell_params->sched_cfg->max_aggr_level : 3;
// set fixed mcs
fixed_mcs_dl = cell_params->sched_cfg->pdsch_mcs;
fixed_mcs_ul = cell_params->sched_cfg->pusch_mcs;
// Generate allowed CCE locations
for (int cfi = 0; cfi < 3; cfi++) {
for (int sf_idx = 0; sf_idx < 10; sf_idx++) {
sched::generate_cce_location(cell_params->regs.get(), &dci_locations[cfi][sf_idx], cfi + 1, sf_idx, rnti);
}
}
set_cfg(cfg_);
}
void sched_ue_carrier::reset()
@ -1133,6 +1117,16 @@ void sched_ue_carrier::reset()
}
}
void sched_ue_carrier::set_cfg(const sched_interface::ue_cfg_t& cfg_)
{
cfg = &cfg_;
// Config HARQ processes
for (uint32_t i = 0; i < dl_harq.size(); ++i) {
dl_harq[i].set_cfg(cfg->maxharq_tx);
ul_harq[i].set_cfg(cfg->maxharq_tx);
}
}
void sched_ue_carrier::reset_old_pending_pids(uint32_t tti_rx)
{
uint32_t tti_tx_dl = TTI_TX(tti_rx), tti_tx_ul = TTI_RX_ACK(tti_rx);

@ -182,12 +182,12 @@ void rrc::log_rrc_message(const std::string& source,
void rrc::max_retx_attempted(uint16_t rnti) {}
// This function is called from PRACH worker (can wait)
void rrc::add_user(uint16_t rnti)
void rrc::add_user(uint16_t rnti, const sched_interface::ue_cfg_t& sched_ue_cfg)
{
pthread_mutex_lock(&user_mutex);
auto user_it = users.find(rnti);
if (user_it == users.end()) {
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, sched_ue_cfg})));
rlc->add_user(rnti);
pdcp->add_user(rnti);
rrc_log->info("Added new user rnti=0x%x\n", rnti);
@ -1009,10 +1009,11 @@ void rrc::tti_clock()
need extra protection.
*******************************************************************************/
rrc::ue::ue(rrc* outer_rrc, uint16_t rnti_) :
rrc::ue::ue(rrc* outer_rrc, uint16_t rnti_, const sched_interface::ue_cfg_t& sched_ue_cfg) :
parent(outer_rrc),
rnti(rnti_),
pool(srslte::byte_buffer_pool::get_instance())
pool(srslte::byte_buffer_pool::get_instance()),
current_sched_ue_cfg(sched_ue_cfg)
{
activity_timer = outer_rrc->timers->get_unique_timer();
set_activity_timeout(MSG3_RX_TIMEOUT); // next UE response is Msg3
@ -1241,6 +1242,17 @@ void rrc::ue::handle_rrc_con_setup_complete(rrc_conn_setup_complete_s* msg, srsl
void rrc::ue::handle_rrc_reconf_complete(rrc_conn_recfg_complete_s* msg, srslte::unique_byte_buffer_t pdu)
{
if (last_rrc_conn_recfg.rrc_transaction_id == msg->rrc_transaction_id) {
// Finally, add secondary carriers
// TODO: For now the ue supports all cc
auto& list = current_sched_ue_cfg.supported_cc_idxs;
for (uint32_t i = 0; i < parent->cfg.cell_list.size(); ++i) {
auto it = std::find(list.begin(), list.end(), i);
if (it == list.end()) {
list.push_back(i);
}
}
parent->mac->ue_cfg(rnti, &current_sched_ue_cfg);
// Finally, add SRB2 and DRB1 to the scheduler
srsenb::sched_interface::ue_bearer_cfg_t bearer_cfg;
bearer_cfg.direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
@ -1580,36 +1592,30 @@ void rrc::ue::send_connection_setup(bool is_setup)
phy_cfg->cqi_report_cfg.nom_pdsch_rs_epre_offset = 0;
// Add SRB1 to Scheduler
srsenb::sched_interface::ue_cfg_t ue_cfg = {};
ue_cfg.maxharq_tx = parent->cfg.mac_cnfg.ul_sch_cfg.max_harq_tx.to_number();
ue_cfg.continuous_pusch = false;
ue_cfg.aperiodic_cqi_period = parent->cfg.cqi_cfg.mode == RRC_CFG_CQI_MODE_APERIODIC ? parent->cfg.cqi_cfg.period : 0;
ue_cfg.ue_bearers[0].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.ue_bearers[1].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
current_sched_ue_cfg.maxharq_tx = parent->cfg.mac_cnfg.ul_sch_cfg.max_harq_tx.to_number();
current_sched_ue_cfg.continuous_pusch = false;
current_sched_ue_cfg.ue_bearers[0].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
current_sched_ue_cfg.ue_bearers[1].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
if (parent->cfg.cqi_cfg.mode == RRC_CFG_CQI_MODE_APERIODIC) {
ue_cfg.aperiodic_cqi_period = parent->cfg.cqi_cfg.mode == parent->cfg.cqi_cfg.period;
ue_cfg.dl_cfg.cqi_report.aperiodic_configured = true;
current_sched_ue_cfg.aperiodic_cqi_period = parent->cfg.cqi_cfg.period;
current_sched_ue_cfg.dl_cfg.cqi_report.aperiodic_configured = true;
} else {
ue_cfg.dl_cfg.cqi_report.pmi_idx = cqi_idx;
ue_cfg.dl_cfg.cqi_report.periodic_configured = true;
}
ue_cfg.dl_cfg.tm = SRSLTE_TM1;
ue_cfg.pucch_cfg.I_sr = sr_I;
ue_cfg.pucch_cfg.n_pucch_sr = sr_N_pucch;
ue_cfg.pucch_cfg.sr_configured = true;
ue_cfg.pucch_cfg.n_pucch = cqi_pucch;
ue_cfg.pucch_cfg.delta_pucch_shift = parent->sib2.rr_cfg_common.pucch_cfg_common.delta_pucch_shift.to_number();
ue_cfg.pucch_cfg.N_cs = parent->sib2.rr_cfg_common.pucch_cfg_common.ncs_an;
ue_cfg.pucch_cfg.n_rb_2 = parent->sib2.rr_cfg_common.pucch_cfg_common.nrb_cqi;
ue_cfg.pucch_cfg.N_pucch_1 = parent->sib2.rr_cfg_common.pucch_cfg_common.n1_pucch_an;
// TODO: For now the ue supports all cc
ue_cfg.supported_cc_idxs.resize(parent->cfg.cell_list.size());
for (uint32_t i = 0; i < ue_cfg.supported_cc_idxs.size(); ++i) {
ue_cfg.supported_cc_idxs[i] = i;
}
current_sched_ue_cfg.dl_cfg.cqi_report.pmi_idx = cqi_idx;
current_sched_ue_cfg.dl_cfg.cqi_report.periodic_configured = true;
}
current_sched_ue_cfg.dl_cfg.tm = SRSLTE_TM1;
current_sched_ue_cfg.pucch_cfg.I_sr = sr_I;
current_sched_ue_cfg.pucch_cfg.n_pucch_sr = sr_N_pucch;
current_sched_ue_cfg.pucch_cfg.sr_configured = true;
current_sched_ue_cfg.pucch_cfg.n_pucch = cqi_pucch;
current_sched_ue_cfg.pucch_cfg.delta_pucch_shift =
parent->sib2.rr_cfg_common.pucch_cfg_common.delta_pucch_shift.to_number();
current_sched_ue_cfg.pucch_cfg.N_cs = parent->sib2.rr_cfg_common.pucch_cfg_common.ncs_an;
current_sched_ue_cfg.pucch_cfg.n_rb_2 = parent->sib2.rr_cfg_common.pucch_cfg_common.nrb_cqi;
current_sched_ue_cfg.pucch_cfg.N_pucch_1 = parent->sib2.rr_cfg_common.pucch_cfg_common.n1_pucch_an;
// Configure MAC
parent->mac->ue_cfg(rnti, &ue_cfg);
parent->mac->ue_cfg(rnti, &current_sched_ue_cfg);
// Configure SRB1 in RLC
parent->rlc->add_bearer(rnti, 1, srslte::rlc_config_t::srb_config(1));

@ -118,7 +118,7 @@ int main(int argc, char* argv[])
bzero(&bearer_cfg, sizeof(srsenb::sched_interface::ue_bearer_cfg_t));
bearer_cfg.direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
my_sched.ue_cfg(rnti, &ue_cfg);
my_sched.ue_cfg(rnti, ue_cfg);
my_sched.bearer_ue_cfg(rnti, 0, &bearer_cfg);
// my_sched.dl_rlc_buffer_state(rnti, 0, 1e6, 0);
my_sched.ul_bsr(rnti, 0, 1e6f, true);

@ -255,7 +255,7 @@ int sched_tester::add_user(uint16_t rnti,
info.preamble_idx = tti_data.nof_prachs++;
tester_ues.insert(std::make_pair(rnti, info));
CONDERROR(ue_cfg(rnti, &ue_cfg_) != SRSLTE_SUCCESS, "[TESTER] Configuring new user rnti=0x%x to sched\n", rnti);
CONDERROR(ue_cfg(rnti, ue_cfg_) != SRSLTE_SUCCESS, "[TESTER] Configuring new user rnti=0x%x to sched\n", rnti);
dl_sched_rar_info_t rar_info = {};
rar_info.prach_tti = tti_data.tti_rx;

@ -54,7 +54,7 @@ int test_erab_setup(bool qci_exists)
};
uint16_t rnti = 0x46;
rrc.add_user(rnti);
rrc.add_user(rnti, {});
rrc_log->set_level(srslte::LOG_LEVEL_NONE); // mute all the startup log

@ -289,7 +289,7 @@ int test_mobility_class(mobility_test_params test_params)
};
uint16_t rnti = 0x46;
rrc.add_user(rnti);
rrc.add_user(rnti, {});
rrc_log->set_level(srslte::LOG_LEVEL_NONE); // mute all the startup log
// Do all the handshaking until the first RRC Connection Reconf

Loading…
Cancel
Save