support cc cfg from rrc

master
Francisco Paisana 5 years ago
parent 095d0cda5a
commit 88a22e7dbf

@ -118,6 +118,7 @@ public:
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;
};
typedef struct {
@ -216,9 +217,9 @@ public:
virtual int reset() = 0;
/* Manages UE scheduling context */
virtual int ue_cfg(uint16_t rnti, uint32_t enb_cc_idx, 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, 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, uint32_t enb_cc_idx, ue_cfg_t* ue_cfg) final;
int ue_cfg(uint16_t rnti, 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);

@ -44,7 +44,7 @@ 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(sched_interface::ue_cfg_t* cfg_, const sched_cell_params_t& cell_cfg_, uint16_t rnti_);
void reset();
// Harq access
@ -104,10 +104,8 @@ public:
sched_ue();
void reset();
void phy_config_enabled(uint32_t tti, bool enabled);
void set_cfg(uint16_t rnti,
const std::vector<sched_cell_params_t>& cell_list_params_,
sched_interface::ue_cfg_t* cfg,
uint32_t primary_cc_idx_);
void init(uint16_t rnti, const std::vector<sched_cell_params_t>& cell_list_params_);
void set_cfg(sched_interface::ue_cfg_t* cfg);
void set_bearer_cfg(uint32_t lc_id, srsenb::sched_interface::ue_bearer_cfg_t* cfg);
void rem_bearer(uint32_t lc_id);
@ -270,6 +268,7 @@ private:
uint32_t max_msg3retx = 0;
/* User State */
bool configured = false;
bool conres_ce_pending = true;
uint32_t nof_ta_cmd = 0;

@ -200,7 +200,7 @@ int mac::ue_cfg(uint16_t rnti, sched_interface::ue_cfg_t* cfg)
{
int ret = -1;
pthread_rwlock_rdlock(&rwlock);
if (ue_db.count(rnti)) {
if (ue_db.count(rnti) > 0) {
// Add RNTI to the PHY (pregerate signals) now instead of after PRACH
if (!ue_db[rnti]->is_phy_added) {
@ -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, 0, cfg) : false) { // TODO: provide enb_cc_idx
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;
@ -458,12 +458,12 @@ int mac::rach_detected(uint32_t tti, uint32_t enb_cc_idx, uint32_t preamble_idx,
{
log_h->step(tti);
pthread_rwlock_rdlock(&rwlock);
pthread_rwlock_wrlock(&rwlock);
uint32_t rnti = last_rnti;
// Create new UE
if (!ue_db.count(rnti)) {
if (ue_db.count(rnti) == 0) {
ue_db[rnti] = new ue(rnti, cell.nof_prb, &scheduler, rrc_h, rlc_h, log_h, SRSLTE_FDD_NOF_HARQ);
}
@ -483,10 +483,11 @@ int mac::rach_detected(uint32_t tti, uint32_t enb_cc_idx, uint32_t preamble_idx,
rar_info.prach_tti = tti;
// Add new user to the scheduler so that it can RX/TX SRB0
sched_interface::ue_cfg_t uecfg;
bzero(&uecfg, sizeof(sched_interface::ue_cfg_t));
uecfg.ue_bearers[0].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
if (scheduler.ue_cfg(rnti, enb_cc_idx, &uecfg)) {
sched_interface::ue_cfg_t ue_cfg = {};
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) {
Error("Registering new user rnti=0x%x to SCHED\n", rnti);
return -1;
}

@ -200,11 +200,14 @@ int sched::cell_cfg(const std::vector<sched_interface::cell_cfg_t>& cell_cfg)
*
*******************************************************/
int sched::ue_cfg(uint16_t rnti, uint32_t enb_cc_idx, sched_interface::ue_cfg_t* ue_cfg)
int sched::ue_cfg(uint16_t rnti, sched_interface::ue_cfg_t* ue_cfg)
{
// Add or config user
pthread_rwlock_wrlock(&rwlock);
ue_db[rnti].set_cfg(rnti, sched_cell_params, ue_cfg, enb_cc_idx);
pthread_rwlock_rdlock(&rwlock);
if (ue_db.count(rnti) == 0) {
ue_db[rnti].init(rnti, sched_cell_params);
}
ue_db[rnti].set_cfg(ue_cfg);
pthread_rwlock_unlock(&rwlock);
return 0;

@ -60,32 +60,49 @@ sched_ue::sched_ue()
reset();
}
void sched_ue::set_cfg(uint16_t rnti_,
const std::vector<sched_cell_params_t>& cell_list_params_,
sched_interface::ue_cfg_t* cfg_,
uint32_t primary_cc_idx_)
void sched_ue::init(uint16_t rnti_, const std::vector<sched_cell_params_t>& cell_list_params_)
{
reset();
{
std::lock_guard<std::mutex> lock(mutex);
rnti = rnti_;
cell_params_list = &cell_list_params_;
main_cc_params = &(*cell_params_list)[primary_cc_idx_];
cell = main_cc_params->cfg.cell;
}
Info("SCHED: Added user rnti=0x%x\n", rnti);
}
max_msg3retx = main_cc_params->cfg.maxharq_msg3tx;
void sched_ue::set_cfg(sched_interface::ue_cfg_t* cfg_)
{
{
std::lock_guard<std::mutex> lock(mutex);
// store previous supported cc idxs
std::vector<uint32_t> prev_cc_idxs(std::move(cfg.supported_cc_idxs));
cfg = *cfg_;
// Initialize TM
cfg.dl_cfg.tm = SRSLTE_TM1;
// if no list of supported cc idxs is provided, we keep the previous one
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);
} else {
cfg.supported_cc_idxs = prev_cc_idxs;
}
}
Info("SCHED: Added user rnti=0x%x\n", rnti);
// 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]];
cell = main_cc_params->cfg.cell;
max_msg3retx = main_cc_params->cfg.maxharq_msg3tx;
}
// Init sched_ue carriers
carriers.emplace_back(&cfg, main_cc_params, rnti);
enb_ue_cellindex_map[primary_cc_idx_] = 0;
// 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;
}
}
for (int i = 0; i < sched_interface::MAX_LC; i++) {
@ -96,13 +113,14 @@ void sched_ue::set_cfg(uint16_t rnti_,
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()
{
{
std::lock_guard<std::mutex> lock(mutex);
bzero(&cfg, sizeof(sched_interface::ue_cfg_t));
cfg = {};
sr = false;
next_tpc_pusch = 1;
next_tpc_pucch = 1;
@ -112,6 +130,7 @@ void sched_ue::reset()
cqi_request_tti = 0;
conres_ce_pending = true;
carriers.clear();
enb_ue_cellindex_map.clear();
}
for (int i = 0; i < sched_interface::MAX_LC; i++) {
@ -1075,10 +1094,10 @@ int sched_ue::cqi_to_tbs(uint32_t cqi,
***********************************************************************************************/
sched_ue_carrier::sched_ue_carrier(sched_interface::ue_cfg_t* cfg_,
const sched_cell_params_t* cell_cfg_,
const sched_cell_params_t& cell_cfg_,
uint16_t rnti_) :
cfg(cfg_),
cell_params(cell_cfg_),
cell_params(&cell_cfg_),
rnti(rnti_),
log_h(srslte::logmap::get("MAC "))
{

@ -1580,32 +1580,36 @@ 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 sched_cfg;
bzero(&sched_cfg, sizeof(srsenb::sched_interface::ue_cfg_t));
sched_cfg.maxharq_tx = parent->cfg.mac_cnfg.ul_sch_cfg.max_harq_tx.to_number();
sched_cfg.continuous_pusch = false;
sched_cfg.aperiodic_cqi_period =
parent->cfg.cqi_cfg.mode == RRC_CFG_CQI_MODE_APERIODIC ? parent->cfg.cqi_cfg.period : 0;
sched_cfg.ue_bearers[0].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
sched_cfg.ue_bearers[1].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
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;
if (parent->cfg.cqi_cfg.mode == RRC_CFG_CQI_MODE_APERIODIC) {
sched_cfg.aperiodic_cqi_period = parent->cfg.cqi_cfg.mode == parent->cfg.cqi_cfg.period;
sched_cfg.dl_cfg.cqi_report.aperiodic_configured = true;
ue_cfg.aperiodic_cqi_period = parent->cfg.cqi_cfg.mode == parent->cfg.cqi_cfg.period;
ue_cfg.dl_cfg.cqi_report.aperiodic_configured = true;
} else {
sched_cfg.dl_cfg.cqi_report.pmi_idx = cqi_idx;
sched_cfg.dl_cfg.cqi_report.periodic_configured = true;
}
sched_cfg.pucch_cfg.I_sr = sr_I;
sched_cfg.pucch_cfg.n_pucch_sr = sr_N_pucch;
sched_cfg.pucch_cfg.sr_configured = true;
sched_cfg.pucch_cfg.n_pucch = cqi_pucch;
sched_cfg.pucch_cfg.delta_pucch_shift = parent->sib2.rr_cfg_common.pucch_cfg_common.delta_pucch_shift.to_number();
sched_cfg.pucch_cfg.N_cs = parent->sib2.rr_cfg_common.pucch_cfg_common.ncs_an;
sched_cfg.pucch_cfg.n_rb_2 = parent->sib2.rr_cfg_common.pucch_cfg_common.nrb_cqi;
sched_cfg.pucch_cfg.N_pucch_1 = parent->sib2.rr_cfg_common.pucch_cfg_common.n1_pucch_an;
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;
}
// Configure MAC
parent->mac->ue_cfg(rnti, &sched_cfg);
parent->mac->ue_cfg(rnti, &ue_cfg);
// Configure SRB1 in RLC
parent->rlc->add_bearer(rnti, 1, srslte::rlc_config_t::srb_config(1));

@ -107,9 +107,9 @@ int main(int argc, char* argv[])
srsenb::sched_interface::dl_sched_res_t sched_result_dl;
srsenb::sched_interface::ul_sched_res_t sched_result_ul;
srsenb::sched_interface::ue_cfg_t ue_cfg;
bzero(&ue_cfg, sizeof(srsenb::sched_interface::ue_cfg_t));
uint16_t rnti = 30;
srsenb::sched_interface::ue_cfg_t ue_cfg = {};
ue_cfg.supported_cc_idxs = {0};
uint16_t rnti = 30;
ue_cfg.aperiodic_cqi_period = 40;
ue_cfg.maxharq_tx = 5;
@ -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, 0, &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,9 +255,8 @@ int sched_tester::add_user(uint16_t rnti,
info.preamble_idx = tti_data.nof_prachs++;
tester_ues.insert(std::make_pair(rnti, info));
if (ue_cfg(rnti, CARRIER_IDX, &ue_cfg_) != SRSLTE_SUCCESS) {
TESTERROR("[TESTER] Registering 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;
rar_info.temp_crnti = rnti;
@ -980,9 +979,12 @@ sched_sim_args rand_sim_params(const srsenb::sched_interface::cell_cfg_t& cell_c
uint32_t max_nof_users = 5;
std::uniform_int_distribution<> connection_dur_dist(min_conn_dur, max_conn_dur);
bzero(&sim_args.ue_cfg, sizeof(srsenb::sched_interface::ue_cfg_t));
sim_args.ue_cfg = {};
sim_args.ue_cfg.aperiodic_cqi_period = 40;
sim_args.ue_cfg.maxharq_tx = 5;
sim_args.ue_cfg.dl_cfg.tm = SRSLTE_TM1;
sim_args.ue_cfg.supported_cc_idxs.push_back(0);
sim_args.ue_cfg.ue_bearers[0].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
bzero(&sim_args.bearer_cfg, sizeof(srsenb::sched_interface::ue_bearer_cfg_t));
sim_args.bearer_cfg.direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;

Loading…
Cancel
Save