rename cell_info_common->enb_cell_common and cell_ctxt_dedicated->ue_cell_ded

master
Francisco 4 years ago committed by Andre Puschmann
parent bdc1964335
commit 324cb80cac

@ -142,7 +142,7 @@ private:
srslte::log_ref rrc_log;
// derived params
std::unique_ptr<cell_info_common_list> cell_common_list;
std::unique_ptr<enb_cell_common_list> cell_common_list;
// state
std::unique_ptr<freq_res_common_list> cell_res_list;

@ -27,6 +27,50 @@
namespace srsenb {
/// Storage of cell-specific eNB config and derived params
struct enb_cell_common {
uint32_t enb_cc_idx = 0;
asn1::rrc::mib_s mib;
asn1::rrc::sib_type1_s sib1;
asn1::rrc::sib_type2_s sib2;
const cell_cfg_t& cell_cfg;
std::vector<srslte::unique_byte_buffer_t> sib_buffer; ///< Packed SIBs for given CC
std::vector<const enb_cell_common*> scells;
enb_cell_common(uint32_t idx_, const cell_cfg_t& cfg) : enb_cc_idx(idx_), cell_cfg(cfg) {}
};
class enb_cell_common_list
{
public:
explicit enb_cell_common_list(const rrc_cfg_t& cfg_);
enb_cell_common* get_cc_idx(uint32_t enb_cc_idx) { return cell_list[enb_cc_idx].get(); }
const enb_cell_common* get_cc_idx(uint32_t enb_cc_idx) const { return cell_list[enb_cc_idx].get(); }
const enb_cell_common* get_cell_id(uint32_t cell_id) const;
const enb_cell_common* get_pci(uint32_t pci) const;
size_t nof_cells() const { return cell_list.size(); }
// container interface
using value_type = std::unique_ptr<enb_cell_common>;
using iterator = std::vector<value_type>::iterator;
using const_iterator = const std::vector<value_type>::const_iterator;
iterator begin() { return cell_list.begin(); }
iterator end() { return cell_list.end(); }
const_iterator begin() const { return cell_list.begin(); }
const_iterator end() const { return cell_list.end(); }
size_t size() const { return cell_list.size(); }
private:
const rrc_cfg_t& cfg;
std::vector<std::unique_ptr<enb_cell_common> > cell_list;
};
// Helper methods
std::vector<const enb_cell_common*> get_cfg_intraenb_scells(const enb_cell_common_list& list,
uint32_t pcell_enb_cc_idx);
std::vector<uint32_t> get_measobj_earfcns(const enb_cell_common& pcell);
class cell_res_common
{
public:
@ -56,45 +100,11 @@ private:
std::map<uint32_t, cell_res_common> pucch_res_list;
};
/** Storage of cell-specific eNB config and derived params */
struct cell_info_common {
uint32_t enb_cc_idx = 0;
asn1::rrc::mib_s mib;
asn1::rrc::sib_type1_s sib1;
asn1::rrc::sib_type2_s sib2;
const cell_cfg_t& cell_cfg;
std::vector<srslte::unique_byte_buffer_t> sib_buffer; ///< Packed SIBs for given CC
std::vector<const cell_info_common*> scells;
cell_info_common(uint32_t idx_, const cell_cfg_t& cfg) : enb_cc_idx(idx_), cell_cfg(cfg) {}
};
class cell_info_common_list
{
public:
explicit cell_info_common_list(const rrc_cfg_t& cfg_);
cell_info_common* get_cc_idx(uint32_t enb_cc_idx) { return cell_list[enb_cc_idx].get(); }
const cell_info_common* get_cc_idx(uint32_t enb_cc_idx) const { return cell_list[enb_cc_idx].get(); }
const cell_info_common* get_cell_id(uint32_t cell_id) const;
const cell_info_common* get_pci(uint32_t pci) const;
size_t nof_cells() const { return cell_list.size(); }
private:
const rrc_cfg_t& cfg;
std::vector<std::unique_ptr<cell_info_common> > cell_list;
};
// Helper methods
std::vector<const cell_info_common*> get_cfg_intraenb_scells(const cell_info_common_list& list,
uint32_t pcell_enb_cc_idx);
std::vector<uint32_t> get_measobj_earfcns(const cell_info_common& pcell);
/** Class used to store all the resources specific to a UE's cell */
struct cell_ctxt_dedicated {
uint32_t ue_cc_idx;
const cell_info_common* cell_common;
bool cqi_res_present = false;
struct ue_cell_ded {
uint32_t ue_cc_idx;
const enb_cell_common* cell_common;
bool cqi_res_present = false;
struct cqi_res_t {
uint32_t pmi_idx = 0;
uint32_t pucch_res = 0;
@ -104,50 +114,49 @@ struct cell_ctxt_dedicated {
uint32_t meas_gap_period = 0;
uint32_t meas_gap_offset = 0;
explicit cell_ctxt_dedicated(uint32_t i_, const cell_info_common& c_) : ue_cc_idx(i_), cell_common(&c_) {}
explicit ue_cell_ded(uint32_t i_, const enb_cell_common& c_) : ue_cc_idx(i_), cell_common(&c_) {}
// forbid copying to not break counting of pucch allocated resources
cell_ctxt_dedicated(const cell_ctxt_dedicated&) = delete;
cell_ctxt_dedicated(cell_ctxt_dedicated&&) noexcept = default;
cell_ctxt_dedicated& operator=(const cell_ctxt_dedicated&) = delete;
cell_ctxt_dedicated& operator=(cell_ctxt_dedicated&&) noexcept = default;
ue_cell_ded(const ue_cell_ded&) = delete;
ue_cell_ded(ue_cell_ded&&) noexcept = default;
ue_cell_ded& operator=(const ue_cell_ded&) = delete;
ue_cell_ded& operator=(ue_cell_ded&&) noexcept = default;
uint32_t get_dl_earfcn() const { return cell_common->cell_cfg.dl_earfcn; }
uint32_t get_pci() const { return cell_common->cell_cfg.pci; }
};
/** Class used to handle the allocation of a UE's resources across its cells */
class cell_ctxt_dedicated_list
class ue_cell_ded_list
{
public:
explicit cell_ctxt_dedicated_list(const rrc_cfg_t& cfg_,
freq_res_common_list& cell_res_list_,
const cell_info_common_list& enb_common_list);
~cell_ctxt_dedicated_list();
explicit ue_cell_ded_list(const rrc_cfg_t& cfg_,
freq_res_common_list& cell_res_list_,
const enb_cell_common_list& enb_common_list);
~ue_cell_ded_list();
cell_ctxt_dedicated* add_cell(uint32_t enb_cc_idx);
bool rem_last_cell();
bool set_cells(const std::vector<uint32_t>& enb_cc_idxs);
ue_cell_ded* add_cell(uint32_t enb_cc_idx);
bool rem_last_cell();
bool set_cells(const std::vector<uint32_t>& enb_cc_idxs);
cell_ctxt_dedicated* get_ue_cc_idx(uint32_t ue_cc_idx)
{
return (ue_cc_idx < nof_cells()) ? &cell_ded_list[ue_cc_idx] : nullptr;
}
const cell_ctxt_dedicated* get_ue_cc_idx(uint32_t ue_cc_idx) const
ue_cell_ded* get_ue_cc_idx(uint32_t ue_cc_idx) { return (ue_cc_idx < nof_cells()) ? &cell_list[ue_cc_idx] : nullptr; }
const ue_cell_ded* get_ue_cc_idx(uint32_t ue_cc_idx) const
{
return (ue_cc_idx < nof_cells()) ? &cell_ded_list[ue_cc_idx] : nullptr;
return (ue_cc_idx < nof_cells()) ? &cell_list[ue_cc_idx] : nullptr;
}
cell_ctxt_dedicated* get_enb_cc_idx(uint32_t enb_cc_idx);
const cell_ctxt_dedicated* find_cell(uint32_t earfcn, uint32_t pci) const;
size_t nof_cells() const { return cell_ded_list.size(); }
bool is_allocated() const { return nof_cells() > 0; }
using iterator = std::vector<cell_ctxt_dedicated>::iterator;
using const_iterator = std::vector<cell_ctxt_dedicated>::const_iterator;
iterator begin() { return cell_ded_list.begin(); }
iterator end() { return cell_ded_list.end(); }
const_iterator begin() const { return cell_ded_list.begin(); }
const_iterator end() const { return cell_ded_list.end(); }
ue_cell_ded* get_enb_cc_idx(uint32_t enb_cc_idx);
const ue_cell_ded* find_cell(uint32_t earfcn, uint32_t pci) const;
size_t nof_cells() const { return cell_list.size(); }
bool is_allocated() const { return nof_cells() > 0; }
// container interface
using iterator = std::vector<ue_cell_ded>::iterator;
using const_iterator = std::vector<ue_cell_ded>::const_iterator;
iterator begin() { return cell_list.begin(); }
iterator end() { return cell_list.end(); }
const_iterator begin() const { return cell_list.begin(); }
const_iterator end() const { return cell_list.end(); }
size_t size() const { return cell_list.size(); }
struct sr_res_t {
int sr_sched_sf_idx = 0;
@ -169,17 +178,17 @@ private:
bool alloc_pucch_cs_resources();
bool dealloc_pucch_cs_resources();
srslte::log_ref log_h{"RRC"};
const rrc_cfg_t& cfg;
const cell_info_common_list& common_list;
freq_res_common_list& cell_res_list;
cell_res_common* pucch_res = nullptr;
std::vector<cell_ctxt_dedicated> cell_ded_list;
bool sr_res_present = false;
bool n_pucch_cs_present = false;
sr_res_t sr_res = {};
uint16_t n_pucch_cs_idx = 0;
srslte::log_ref log_h{"RRC"};
const rrc_cfg_t& cfg;
const enb_cell_common_list& common_list;
freq_res_common_list& cell_res_list;
cell_res_common* pucch_res = nullptr;
std::vector<ue_cell_ded> cell_list;
bool sr_res_present = false;
bool n_pucch_cs_present = false;
sr_res_t sr_res = {};
uint16_t n_pucch_cs_idx = 0;
};
} // namespace srsenb

@ -60,7 +60,7 @@ public:
private:
// helper methods
bool update_ue_var_meas_cfg(uint32_t src_earfcn,
const cell_info_common& target_pcell,
const enb_cell_common& target_pcell,
asn1::rrc::meas_cfg_s* diff_meas_cfg);
// Handover from source cell
@ -69,7 +69,7 @@ private:
// Handover to target cell
void fill_mobility_reconf_common(asn1::rrc::dl_dcch_msg_s& msg,
const cell_info_common& target_cell,
const enb_cell_common& target_cell,
uint32_t src_dl_earfcn,
uint32_t src_pci);
bool apply_ho_prep_cfg(const asn1::rrc::ho_prep_info_r8_ies_s& ho_prep, const asn1::s1ap::ho_request_s& ho_req_msg);
@ -99,8 +99,8 @@ private:
// states
struct idle_st {};
struct intraenb_ho_st {
const cell_info_common* target_cell = nullptr;
const cell_info_common* source_cell = nullptr;
const enb_cell_common* target_cell = nullptr;
const enb_cell_common* source_cell = nullptr;
uint16_t last_temp_crnti = SRSLTE_INVALID_RNTI;
void enter(rrc_mobility* f, const ho_meas_report_ev& meas_report);

@ -127,15 +127,15 @@ private:
const static uint32_t UE_PCELL_CC_IDX = 0;
cell_ctxt_dedicated_list cell_ded_list;
bearer_cfg_handler bearer_list;
security_cfg_handler ue_security_cfg;
ue_cell_ded_list ue_cell_list;
bearer_cfg_handler bearer_list;
security_cfg_handler ue_security_cfg;
class mac_controller;
std::unique_ptr<mac_controller> mac_ctrl;
///< Helper to access a cell cfg based on ue_cc_idx
cell_info_common* get_ue_cc_cfg(uint32_t ue_cc_idx);
enb_cell_common* get_ue_cc_cfg(uint32_t ue_cc_idx);
/// Helper to fill cell_ded_list with SCells provided in the eNB config
void update_scells();

@ -29,7 +29,7 @@ namespace srsenb {
// fwd declarations
struct rrc_cfg_t;
struct meas_cell_cfg_t;
class cell_ctxt_dedicated_list;
class ue_cell_ded_list;
using meas_obj_t = asn1::rrc::meas_obj_to_add_mod_s;
using meas_obj_list = asn1::rrc::meas_obj_to_add_mod_list_l;
@ -66,7 +66,7 @@ bool compute_diff_meascfg(const asn1::rrc::meas_cfg_s& current_meascfg,
const asn1::rrc::meas_cfg_s& target_meascfg,
asn1::rrc::meas_cfg_s& diff_meascfg);
bool fill_meascfg_enb_cfg(asn1::rrc::meas_cfg_s& meascfg, const cell_ctxt_dedicated_list& ue_cell_list);
bool fill_meascfg_enb_cfg(asn1::rrc::meas_cfg_s& meascfg, const ue_cell_ded_list& ue_cell_list);
/**
* Computes diff measConfig based on the previous measConfig and the UE current cells
@ -79,7 +79,7 @@ bool fill_meascfg_enb_cfg(asn1::rrc::meas_cfg_s& meascfg, const cell_ctxt_dedica
*/
bool apply_meascfg_updates(asn1::rrc::meas_cfg_s& diff_meascfg,
asn1::rrc::meas_cfg_s& prev_meascfg,
const cell_ctxt_dedicated_list& ue_cell_list,
const ue_cell_ded_list& ue_cell_list,
int prev_earfcn = -1,
int prev_pci = -1);

@ -50,20 +50,20 @@
namespace srsenb {
struct rrc_cfg_t;
class cell_ctxt_dedicated_list;
class ue_cell_ded_list;
class bearer_cfg_handler;
struct ue_var_cfg_t;
/// Fill RadioResourceConfigDedicated with data known at the RRCSetup/Reestablishment stage
void fill_rr_cfg_ded_setup(asn1::rrc::rr_cfg_ded_s& rr_cfg,
const rrc_cfg_t& enb_cfg,
const cell_ctxt_dedicated_list& ue_cell_list);
const ue_cell_ded_list& ue_cell_list);
/// Apply Reconf updates and update current state
void apply_reconf_updates(asn1::rrc::rrc_conn_recfg_r8_ies_s& recfg_r8,
ue_var_cfg_t& current_ue_cfg,
const rrc_cfg_t& enb_cfg,
const cell_ctxt_dedicated_list& ue_cell_list,
const ue_cell_ded_list& ue_cell_list,
bearer_cfg_handler& bearers,
const srslte::rrc_ue_capabilities_t& ue_caps,
bool phy_cfg_updated);

@ -64,7 +64,7 @@ void ue_cfg_apply_srb_updates(ue_cfg_t& ue_cfg, const srb_to_add_mod_list_l& srb
*/
void ue_cfg_apply_reconf_complete_updates(ue_cfg_t& ue_cfg,
const rrc_conn_recfg_r8_ies_s& conn_recfg,
const cell_ctxt_dedicated_list& ue_cell_list);
const ue_cell_ded_list& ue_cell_list);
/**
* Adds to sched_interface::ue_cfg_t the changes present in the asn1 RRCReconfiguration message related to
@ -143,7 +143,7 @@ int rrc::ue::mac_controller::handle_crnti_ce(uint32_t temp_crnti)
int rrc::ue::mac_controller::apply_basic_conn_cfg(const asn1::rrc::rr_cfg_ded_s& rr_cfg)
{
const auto* pcell = rrc_ue->cell_ded_list.get_ue_cc_idx(UE_PCELL_CC_IDX);
const auto* pcell = rrc_ue->ue_cell_list.get_ue_cc_idx(UE_PCELL_CC_IDX);
// Set static config params
current_sched_ue_cfg.maxharq_tx = rrc_cfg->mac_cnfg.ul_sch_cfg.max_harq_tx.to_number();
@ -207,7 +207,7 @@ void rrc::ue::mac_controller::handle_con_reconf(const asn1::rrc::rrc_conn_recfg_
// Store MAC updates that are applied once RRCReconfigurationComplete is received
next_sched_ue_cfg = current_sched_ue_cfg;
ue_cfg_apply_capabilities(next_sched_ue_cfg, *rrc_cfg, uecaps);
ue_cfg_apply_reconf_complete_updates(next_sched_ue_cfg, conn_recfg, rrc_ue->cell_ded_list);
ue_cfg_apply_reconf_complete_updates(next_sched_ue_cfg, conn_recfg, rrc_ue->ue_cell_list);
// Temporarily freeze new allocations for DRBs (SRBs are needed to send RRC Reconf Message)
set_drb_activation(false);
@ -253,7 +253,7 @@ void rrc::ue::mac_controller::handle_target_enb_ho_cmd(const asn1::rrc::rrc_conn
next_sched_ue_cfg = current_sched_ue_cfg;
ue_cfg_apply_capabilities(next_sched_ue_cfg, *rrc_cfg, uecaps);
ue_cfg_apply_reconf_complete_updates(next_sched_ue_cfg, conn_recfg, rrc_ue->cell_ded_list);
ue_cfg_apply_reconf_complete_updates(next_sched_ue_cfg, conn_recfg, rrc_ue->ue_cell_list);
// Temporarily freeze new allocations for DRBs (SRBs are needed to send RRC Reconf Message)
set_drb_activation(false);
@ -273,7 +273,7 @@ void rrc::ue::mac_controller::handle_intraenb_ho_cmd(const asn1::rrc::rrc_conn_r
rrc_ue->parent->cell_common_list->get_pci(conn_recfg.mob_ctrl_info.target_pci)->enb_cc_idx;
ue_cfg_apply_conn_reconf(next_sched_ue_cfg, conn_recfg, *rrc_cfg);
ue_cfg_apply_capabilities(next_sched_ue_cfg, *rrc_cfg, uecaps);
ue_cfg_apply_reconf_complete_updates(next_sched_ue_cfg, conn_recfg, rrc_ue->cell_ded_list);
ue_cfg_apply_reconf_complete_updates(next_sched_ue_cfg, conn_recfg, rrc_ue->ue_cell_list);
// Freeze SCells
// NOTE: this avoids that the UE receives an HOCmd retx from target cell and do an incorrect RLC-level concatenation
@ -391,7 +391,7 @@ void ue_cfg_apply_srb_updates(ue_cfg_t& ue_cfg, const srb_to_add_mod_list_l& srb
void ue_cfg_apply_reconf_complete_updates(ue_cfg_t& ue_cfg,
const rrc_conn_recfg_r8_ies_s& conn_recfg,
const cell_ctxt_dedicated_list& ue_cell_list)
const ue_cell_ded_list& ue_cell_list)
{
// Configure RadioResourceConfigDedicated
if (conn_recfg.rr_cfg_ded_present) {

@ -645,11 +645,11 @@ uint32_t rrc::generate_sibs()
sched_info_list_l& sched_info = cfg.sib1.sched_info_list;
// Store configs,SIBs in common cell ctxt list
cell_common_list.reset(new cell_info_common_list{cfg});
cell_common_list.reset(new enb_cell_common_list{cfg});
// generate and pack into SIB buffers
for (uint32_t cc_idx = 0; cc_idx < cfg.cell_list.size(); cc_idx++) {
cell_info_common* cell_ctxt = cell_common_list->get_cc_idx(cc_idx);
enb_cell_common* cell_ctxt = cell_common_list->get_cc_idx(cc_idx);
// msg is array of SI messages, each SI message msg[i] may contain multiple SIBs
// all SIBs in a SI message msg[i] share the same periodicity
asn1::dyn_array<bcch_dl_sch_msg_s> msg(nof_messages + 1);

@ -25,34 +25,18 @@ using namespace asn1::rrc;
namespace srsenb {
freq_res_common_list::freq_res_common_list(const rrc_cfg_t& cfg_) : cfg(cfg_)
{
for (const auto& c : cfg.cell_list) {
auto it = pucch_res_list.find(c.dl_earfcn);
if (it == pucch_res_list.end()) {
pucch_res_list[c.dl_earfcn] = {};
}
}
}
/********************************
* eNB cell common context
*******************************/
cell_res_common* freq_res_common_list::get_earfcn(uint32_t earfcn)
{
auto it = pucch_res_list.find(earfcn);
return (it == pucch_res_list.end()) ? nullptr : &(it->second);
}
/*************************
* cell ctxt common
************************/
cell_info_common_list::cell_info_common_list(const rrc_cfg_t& cfg_) : cfg(cfg_)
enb_cell_common_list::enb_cell_common_list(const rrc_cfg_t& cfg_) : cfg(cfg_)
{
cell_list.reserve(cfg.cell_list.size());
// Store the SIB cfg of each carrier
for (uint32_t ccidx = 0; ccidx < cfg.cell_list.size(); ++ccidx) {
cell_list.emplace_back(std::unique_ptr<cell_info_common>{new cell_info_common{ccidx, cfg.cell_list[ccidx]}});
cell_info_common* new_cell = cell_list.back().get();
cell_list.emplace_back(std::unique_ptr<enb_cell_common>{new enb_cell_common{ccidx, cfg.cell_list[ccidx]}});
enb_cell_common* new_cell = cell_list.back().get();
// Set Cell MIB
asn1::number_to_enum(new_cell->mib.dl_bw, cfg.cell.nof_prb);
@ -84,7 +68,7 @@ cell_info_common_list::cell_info_common_list(const rrc_cfg_t& cfg_) : cfg(cfg_)
c->scells.resize(cfg.cell_list[i].scell_list.size());
for (uint32_t j = 0; j < c->scells.size(); ++j) {
uint32_t cell_id = cfg.cell_list[i].scell_list[j].cell_id;
auto it = std::find_if(cell_list.begin(), cell_list.end(), [cell_id](const std::unique_ptr<cell_info_common>& e) {
auto it = std::find_if(cell_list.begin(), cell_list.end(), [cell_id](const std::unique_ptr<enb_cell_common>& e) {
return e->cell_cfg.cell_id == cell_id;
});
if (it != cell_list.end()) {
@ -94,27 +78,26 @@ cell_info_common_list::cell_info_common_list(const rrc_cfg_t& cfg_) : cfg(cfg_)
}
}
const cell_info_common* cell_info_common_list::get_cell_id(uint32_t cell_id) const
const enb_cell_common* enb_cell_common_list::get_cell_id(uint32_t cell_id) const
{
auto it = std::find_if(cell_list.begin(), cell_list.end(), [cell_id](const std::unique_ptr<cell_info_common>& c) {
auto it = std::find_if(cell_list.begin(), cell_list.end(), [cell_id](const std::unique_ptr<enb_cell_common>& c) {
return c->cell_cfg.cell_id == cell_id;
});
return it == cell_list.end() ? nullptr : it->get();
}
const cell_info_common* cell_info_common_list::get_pci(uint32_t pci) const
const enb_cell_common* enb_cell_common_list::get_pci(uint32_t pci) const
{
auto it = std::find_if(cell_list.begin(), cell_list.end(), [pci](const std::unique_ptr<cell_info_common>& c) {
auto it = std::find_if(cell_list.begin(), cell_list.end(), [pci](const std::unique_ptr<enb_cell_common>& c) {
return c->cell_cfg.pci == pci;
});
return it == cell_list.end() ? nullptr : it->get();
}
std::vector<const cell_info_common*> get_cfg_intraenb_scells(const cell_info_common_list& list,
uint32_t pcell_enb_cc_idx)
std::vector<const enb_cell_common*> get_cfg_intraenb_scells(const enb_cell_common_list& list, uint32_t pcell_enb_cc_idx)
{
const cell_info_common* pcell = list.get_cc_idx(pcell_enb_cc_idx);
std::vector<const cell_info_common*> cells(pcell->cell_cfg.scell_list.size());
const enb_cell_common* pcell = list.get_cc_idx(pcell_enb_cc_idx);
std::vector<const enb_cell_common*> cells(pcell->cell_cfg.scell_list.size());
for (uint32_t i = 0; i < pcell->cell_cfg.scell_list.size(); ++i) {
uint32_t cell_id = pcell->cell_cfg.scell_list[i].cell_id;
cells[i] = list.get_cell_id(cell_id);
@ -122,7 +105,7 @@ std::vector<const cell_info_common*> get_cfg_intraenb_scells(const cell_info_com
return cells;
}
std::vector<uint32_t> get_measobj_earfcns(const cell_info_common& pcell)
std::vector<uint32_t> get_measobj_earfcns(const enb_cell_common& pcell)
{
// Make a list made of EARFCNs of the PCell and respective SCells (according to conf file)
std::vector<uint32_t> earfcns{};
@ -138,64 +121,84 @@ std::vector<uint32_t> get_measobj_earfcns(const cell_info_common& pcell)
return earfcns;
}
/*************************
* eNB cell resources
************************/
freq_res_common_list::freq_res_common_list(const rrc_cfg_t& cfg_) : cfg(cfg_)
{
for (const auto& c : cfg.cell_list) {
auto it = pucch_res_list.find(c.dl_earfcn);
if (it == pucch_res_list.end()) {
pucch_res_list[c.dl_earfcn] = {};
}
}
}
cell_res_common* freq_res_common_list::get_earfcn(uint32_t earfcn)
{
auto it = pucch_res_list.find(earfcn);
return (it == pucch_res_list.end()) ? nullptr : &(it->second);
}
/*************************
* cell ctxt dedicated
************************/
cell_ctxt_dedicated_list::cell_ctxt_dedicated_list(const rrc_cfg_t& cfg_,
freq_res_common_list& cell_res_list_,
const cell_info_common_list& enb_common_list) :
ue_cell_ded_list::ue_cell_ded_list(const rrc_cfg_t& cfg_,
freq_res_common_list& cell_res_list_,
const enb_cell_common_list& enb_common_list) :
cfg(cfg_), cell_res_list(cell_res_list_), common_list(enb_common_list)
{
cell_ded_list.reserve(common_list.nof_cells());
cell_list.reserve(common_list.nof_cells());
}
cell_ctxt_dedicated_list::~cell_ctxt_dedicated_list()
ue_cell_ded_list::~ue_cell_ded_list()
{
for (auto& c : cell_ded_list) {
for (auto& c : cell_list) {
dealloc_cqi_resources(c.ue_cc_idx);
}
dealloc_sr_resources();
dealloc_pucch_cs_resources();
}
cell_ctxt_dedicated* cell_ctxt_dedicated_list::get_enb_cc_idx(uint32_t enb_cc_idx)
ue_cell_ded* ue_cell_ded_list::get_enb_cc_idx(uint32_t enb_cc_idx)
{
auto it = std::find_if(cell_ded_list.begin(), cell_ded_list.end(), [enb_cc_idx](const cell_ctxt_dedicated& c) {
auto it = std::find_if(cell_list.begin(), cell_list.end(), [enb_cc_idx](const ue_cell_ded& c) {
return c.cell_common->enb_cc_idx == enb_cc_idx;
});
return it == cell_ded_list.end() ? nullptr : &(*it);
return it == cell_list.end() ? nullptr : &(*it);
}
const cell_ctxt_dedicated* cell_ctxt_dedicated_list::find_cell(uint32_t earfcn, uint32_t pci) const
const ue_cell_ded* ue_cell_ded_list::find_cell(uint32_t earfcn, uint32_t pci) const
{
auto it = std::find_if(cell_ded_list.begin(), cell_ded_list.end(), [earfcn, pci](const cell_ctxt_dedicated& c) {
auto it = std::find_if(cell_list.begin(), cell_list.end(), [earfcn, pci](const ue_cell_ded& c) {
return c.get_pci() == pci and c.get_dl_earfcn() == earfcn;
});
return it == cell_ded_list.end() ? nullptr : &(*it);
return it == cell_list.end() ? nullptr : &(*it);
}
cell_ctxt_dedicated* cell_ctxt_dedicated_list::add_cell(uint32_t enb_cc_idx)
ue_cell_ded* ue_cell_ded_list::add_cell(uint32_t enb_cc_idx)
{
const cell_info_common* cell_common = common_list.get_cc_idx(enb_cc_idx);
const enb_cell_common* cell_common = common_list.get_cc_idx(enb_cc_idx);
if (cell_common == nullptr) {
log_h->error("cell with enb_cc_idx=%d does not exist.\n", enb_cc_idx);
return nullptr;
}
cell_ctxt_dedicated* ret = get_enb_cc_idx(enb_cc_idx);
ue_cell_ded* ret = get_enb_cc_idx(enb_cc_idx);
if (ret != nullptr) {
log_h->error("UE already registered cell %d\n", enb_cc_idx);
return nullptr;
}
uint32_t ue_cc_idx = cell_ded_list.size();
uint32_t ue_cc_idx = cell_list.size();
if (ue_cc_idx == UE_PCELL_CC_IDX) {
// Fetch PUCCH resources if it's pcell
pucch_res = cell_res_list.get_earfcn(cell_common->cell_cfg.dl_earfcn);
}
cell_ded_list.emplace_back(cell_ded_list.size(), *cell_common);
cell_list.emplace_back(cell_list.size(), *cell_common);
// Allocate CQI, SR, and PUCCH CS resources. If failure, do not add new cell
if (not alloc_cell_resources(ue_cc_idx)) {
@ -203,25 +206,25 @@ cell_ctxt_dedicated* cell_ctxt_dedicated_list::add_cell(uint32_t enb_cc_idx)
return nullptr;
}
return &cell_ded_list.back();
return &cell_list.back();
}
bool cell_ctxt_dedicated_list::rem_last_cell()
bool ue_cell_ded_list::rem_last_cell()
{
if (cell_ded_list.empty()) {
if (cell_list.empty()) {
return false;
}
uint32_t ue_cc_idx = cell_ded_list.size() - 1;
uint32_t ue_cc_idx = cell_list.size() - 1;
if (ue_cc_idx == UE_PCELL_CC_IDX) {
dealloc_sr_resources();
dealloc_pucch_cs_resources();
}
dealloc_cqi_resources(ue_cc_idx);
cell_ded_list.pop_back();
cell_list.pop_back();
return true;
}
bool cell_ctxt_dedicated_list::alloc_cell_resources(uint32_t ue_cc_idx)
bool ue_cell_ded_list::alloc_cell_resources(uint32_t ue_cc_idx)
{
// Allocate CQI, SR, and PUCCH CS resources. If failure, do not add new cell
if (ue_cc_idx == UE_PCELL_CC_IDX) {
@ -237,9 +240,9 @@ bool cell_ctxt_dedicated_list::alloc_cell_resources(uint32_t ue_cc_idx)
}
}
cell_ctxt_dedicated* cell = get_ue_cc_idx(UE_PCELL_CC_IDX);
cell->meas_gap_period = cell->cell_common->cell_cfg.meas_cfg.meas_gap_period;
cell->meas_gap_offset = pucch_res->next_measgap_offset;
ue_cell_ded* cell = get_ue_cc_idx(UE_PCELL_CC_IDX);
cell->meas_gap_period = cell->cell_common->cell_cfg.meas_cfg.meas_gap_period;
cell->meas_gap_offset = pucch_res->next_measgap_offset;
pucch_res->next_measgap_offset += 6;
}
if (not alloc_cqi_resources(ue_cc_idx, cfg.cqi_cfg.period)) {
@ -255,13 +258,13 @@ bool cell_ctxt_dedicated_list::alloc_cell_resources(uint32_t ue_cc_idx)
* @param enb_cc_idxs list of cells supported by the UE
* @return true if all cells were allocated
*/
bool cell_ctxt_dedicated_list::set_cells(const std::vector<uint32_t>& enb_cc_idxs)
bool ue_cell_ded_list::set_cells(const std::vector<uint32_t>& enb_cc_idxs)
{
// Remove extra previously allocked cells
while (enb_cc_idxs.size() < cell_ded_list.size()) {
while (enb_cc_idxs.size() < cell_list.size()) {
rem_last_cell();
}
if (cell_ded_list.empty()) {
if (cell_list.empty()) {
// There were no previous cells allocated. Just add new ones
for (auto& cc_idx : enb_cc_idxs) {
if (not add_cell(cc_idx)) {
@ -271,18 +274,18 @@ bool cell_ctxt_dedicated_list::set_cells(const std::vector<uint32_t>& enb_cc_idx
return true;
}
const cell_info_common* prev_pcell = cell_ded_list[UE_PCELL_CC_IDX].cell_common;
const cell_info_common* new_pcell = common_list.get_cc_idx(enb_cc_idxs[0]);
bool pcell_freq_changed = prev_pcell->cell_cfg.dl_earfcn != new_pcell->cell_cfg.dl_earfcn;
uint32_t prev_pcell_enb_cc_idx = prev_pcell->enb_cc_idx;
const enb_cell_common* prev_pcell = cell_list[UE_PCELL_CC_IDX].cell_common;
const enb_cell_common* new_pcell = common_list.get_cc_idx(enb_cc_idxs[0]);
bool pcell_freq_changed = prev_pcell->cell_cfg.dl_earfcn != new_pcell->cell_cfg.dl_earfcn;
uint32_t prev_pcell_enb_cc_idx = prev_pcell->enb_cc_idx;
if (pcell_freq_changed) {
// Need to clean all allocated resources if PCell earfcn changes
while (not cell_ded_list.empty()) {
while (not cell_list.empty()) {
rem_last_cell();
}
while (cell_ded_list.size() < enb_cc_idxs.size()) {
if (not add_cell(enb_cc_idxs[cell_ded_list.size()])) {
while (cell_list.size() < enb_cc_idxs.size()) {
if (not add_cell(enb_cc_idxs[cell_list.size()])) {
return false;
}
}
@ -291,39 +294,39 @@ bool cell_ctxt_dedicated_list::set_cells(const std::vector<uint32_t>& enb_cc_idx
uint32_t ue_cc_idx = 0;
for (; ue_cc_idx < enb_cc_idxs.size(); ++ue_cc_idx) {
uint32_t enb_cc_idx = enb_cc_idxs[ue_cc_idx];
const cell_info_common* cell_common = common_list.get_cc_idx(enb_cc_idx);
uint32_t enb_cc_idx = enb_cc_idxs[ue_cc_idx];
const enb_cell_common* cell_common = common_list.get_cc_idx(enb_cc_idx);
if (cell_common == nullptr) {
log_h->error("cell with enb_cc_idx=%d does not exist.\n", enb_cc_idx);
break;
}
auto* prev_cell_common = cell_ded_list[ue_cc_idx].cell_common;
auto* prev_cell_common = cell_list[ue_cc_idx].cell_common;
if (enb_cc_idx == prev_cell_common->enb_cc_idx) {
// Same cell. Do not realloc resources
continue;
}
dealloc_cqi_resources(ue_cc_idx);
cell_ded_list[ue_cc_idx] = cell_ctxt_dedicated{ue_cc_idx, *cell_common};
cell_list[ue_cc_idx] = ue_cell_ded{ue_cc_idx, *cell_common};
if (not alloc_cqi_resources(ue_cc_idx, cfg.cqi_cfg.period)) {
log_h->error("Failed to allocate CQI resources for cell ue_cc_idx=%d\n", ue_cc_idx);
break;
}
}
// Remove cells after the last successful insertion
while (ue_cc_idx < cell_ded_list.size()) {
while (ue_cc_idx < cell_list.size()) {
rem_last_cell();
}
if (cell_ded_list.empty()) {
if (cell_list.empty()) {
// We failed to allocate new PCell. Fallback to old PCell
add_cell(prev_pcell_enb_cc_idx);
}
return ue_cc_idx == enb_cc_idxs.size();
}
bool cell_ctxt_dedicated_list::alloc_cqi_resources(uint32_t ue_cc_idx, uint32_t period)
bool ue_cell_ded_list::alloc_cqi_resources(uint32_t ue_cc_idx, uint32_t period)
{
cell_ctxt_dedicated* cell = get_ue_cc_idx(ue_cc_idx);
ue_cell_ded* cell = get_ue_cc_idx(ue_cc_idx);
if (cell == nullptr) {
log_h->error("The user cell ue_cc_idx=%d has not been allocated\n", ue_cc_idx);
return false;
@ -409,9 +412,9 @@ bool cell_ctxt_dedicated_list::alloc_cqi_resources(uint32_t ue_cc_idx, uint32_t
return true;
}
bool cell_ctxt_dedicated_list::dealloc_cqi_resources(uint32_t ue_cc_idx)
bool ue_cell_ded_list::dealloc_cqi_resources(uint32_t ue_cc_idx)
{
cell_ctxt_dedicated* c = get_ue_cc_idx(ue_cc_idx);
ue_cell_ded* c = get_ue_cc_idx(ue_cc_idx);
if (c == nullptr or not c->cqi_res_present) {
return false;
}
@ -427,9 +430,9 @@ bool cell_ctxt_dedicated_list::dealloc_cqi_resources(uint32_t ue_cc_idx)
return true;
}
bool cell_ctxt_dedicated_list::alloc_sr_resources(uint32_t period)
bool ue_cell_ded_list::alloc_sr_resources(uint32_t period)
{
cell_ctxt_dedicated* cell = get_ue_cc_idx(UE_PCELL_CC_IDX);
ue_cell_ded* cell = get_ue_cc_idx(UE_PCELL_CC_IDX);
if (cell == nullptr) {
log_h->error("The user cell pcell has not been allocated\n");
return false;
@ -494,7 +497,7 @@ bool cell_ctxt_dedicated_list::alloc_sr_resources(uint32_t period)
return true;
}
bool cell_ctxt_dedicated_list::dealloc_sr_resources()
bool ue_cell_ded_list::dealloc_sr_resources()
{
if (sr_res_present) {
if (pucch_res->sr_sched.nof_users[sr_res.sr_sched_prb_idx][sr_res.sr_sched_sf_idx] > 0) {
@ -516,9 +519,9 @@ bool cell_ctxt_dedicated_list::dealloc_sr_resources()
return false;
}
bool cell_ctxt_dedicated_list::alloc_pucch_cs_resources()
bool ue_cell_ded_list::alloc_pucch_cs_resources()
{
cell_ctxt_dedicated* cell = get_ue_cc_idx(UE_PCELL_CC_IDX);
ue_cell_ded* cell = get_ue_cc_idx(UE_PCELL_CC_IDX);
if (cell == nullptr) {
log_h->error("The user cell pcell has not been allocated\n");
return false;
@ -546,7 +549,7 @@ bool cell_ctxt_dedicated_list::alloc_pucch_cs_resources()
return false;
}
bool cell_ctxt_dedicated_list::dealloc_pucch_cs_resources()
bool ue_cell_ded_list::dealloc_pucch_cs_resources()
{
if (n_pucch_cs_present) {
pucch_res->n_pucch_cs_used[n_pucch_cs_idx] = false;

@ -145,7 +145,7 @@ uint16_t rrc::start_ho_ue_resource_alloc(const asn1::s1ap::ho_request_s&
/* Evaluate if cell exists */
uint32_t target_eci = container.target_cell_id.cell_id.to_number();
const cell_info_common* target_cell = cell_common_list->get_cell_id(rrc_details::eci_to_cellid(target_eci));
const enb_cell_common* target_cell = cell_common_list->get_cell_id(rrc_details::eci_to_cellid(target_eci));
if (target_cell == nullptr) {
rrc_log->error("The S1-handover target cell_id=0x%x does not exist\n", rrc_details::eci_to_cellid(target_eci));
return SRSLTE_INVALID_RNTI;
@ -210,7 +210,7 @@ bool rrc::ue::rrc_mobility::fill_conn_recfg_no_ho_cmd(asn1::rrc::rrc_conn_recfg_
// Check if there has been any update in ue_var_meas based on UE current cell list
conn_recfg->meas_cfg_present =
apply_meascfg_updates(conn_recfg->meas_cfg, rrc_ue->current_ue_cfg.meas_cfg, rrc_ue->cell_ded_list);
apply_meascfg_updates(conn_recfg->meas_cfg, rrc_ue->current_ue_cfg.meas_cfg, rrc_ue->ue_cell_list);
return conn_recfg->meas_cfg_present;
}
@ -247,12 +247,12 @@ void rrc::ue::rrc_mobility::handle_ue_meas_report(const meas_report_s& msg)
meas_ev.meas_obj = &(*obj_it);
// iterate from strongest to weakest cell
const cell_ctxt_dedicated* pcell = rrc_ue->cell_ded_list.get_ue_cc_idx(UE_PCELL_CC_IDX);
const ue_cell_ded* pcell = rrc_ue->ue_cell_list.get_ue_cc_idx(UE_PCELL_CC_IDX);
const auto& meas_list_cfg = pcell->cell_common->cell_cfg.meas_cfg.meas_cells;
for (const meas_result_eutra_s& e : eutra_report_list) {
auto same_pci = [&e](const meas_cell_cfg_t& c) { return c.pci == e.pci; };
auto meas_it = std::find_if(meas_list_cfg.begin(), meas_list_cfg.end(), same_pci);
const cell_info_common* c = rrc_enb->cell_common_list->get_pci(e.pci);
const enb_cell_common* c = rrc_enb->cell_common_list->get_pci(e.pci);
if (meas_it != meas_list_cfg.end()) {
meas_ev.target_eci = meas_it->eci;
} else if (c != nullptr) {
@ -287,8 +287,8 @@ bool rrc::ue::rrc_mobility::start_ho_preparation(uint32_t target_eci,
srslte::plmn_id_t target_plmn =
srslte::make_plmn_id_t(rrc_enb->cfg.sib1.cell_access_related_info.plmn_id_list[0].plmn_id);
const cell_ctxt_dedicated* src_cell_ded = rrc_ue->cell_ded_list.get_ue_cc_idx(UE_PCELL_CC_IDX);
const cell_info_common* src_cell_cfg = src_cell_ded->cell_common;
const ue_cell_ded* src_cell_ded = rrc_ue->ue_cell_list.get_ue_cc_idx(UE_PCELL_CC_IDX);
const enb_cell_common* src_cell_cfg = src_cell_ded->cell_common;
/*** Fill HO Preparation Info ***/
asn1::rrc::ho_prep_info_s hoprep;
@ -438,7 +438,7 @@ bool rrc::ue::rrc_mobility::start_s1_tenb_ho(
* @param target_cell
*/
void rrc::ue::rrc_mobility::fill_mobility_reconf_common(asn1::rrc::dl_dcch_msg_s& msg,
const cell_info_common& target_cell,
const enb_cell_common& target_cell,
uint32_t src_dl_earfcn,
uint32_t src_pci)
{
@ -474,12 +474,12 @@ void rrc::ue::rrc_mobility::fill_mobility_reconf_common(asn1::rrc::dl_dcch_msg_s
// Add MeasConfig of target cell
recfg_r8.meas_cfg_present = apply_meascfg_updates(
recfg_r8.meas_cfg, rrc_ue->current_ue_cfg.meas_cfg, rrc_ue->cell_ded_list, src_dl_earfcn, src_pci);
recfg_r8.meas_cfg, rrc_ue->current_ue_cfg.meas_cfg, rrc_ue->ue_cell_list, src_dl_earfcn, src_pci);
apply_reconf_updates(recfg_r8,
rrc_ue->current_ue_cfg,
rrc_enb->cfg,
rrc_ue->cell_ded_list,
rrc_ue->ue_cell_list,
rrc_ue->bearer_list,
rrc_ue->ue_capabilities,
true);
@ -642,7 +642,7 @@ void rrc::ue::rrc_mobility::handle_ho_req(idle_st& s, const ho_req_rx_ev& ho_req
/* Prepare Handover Request Acknowledgment - Handover Command */
dl_dcch_msg_s dl_dcch_msg;
const cell_ctxt_dedicated* target_cell = rrc_ue->cell_ded_list.get_ue_cc_idx(UE_PCELL_CC_IDX);
const ue_cell_ded* target_cell = rrc_ue->ue_cell_list.get_ue_cc_idx(UE_PCELL_CC_IDX);
// Fill fields common to all types of handover (e.g. new CQI/SR configuration, mobControlInfo)
fill_mobility_reconf_common(dl_dcch_msg,
@ -709,7 +709,7 @@ void rrc::ue::rrc_mobility::handle_ho_req(idle_st& s, const ho_req_rx_ev& ho_req
bool rrc::ue::rrc_mobility::apply_ho_prep_cfg(const ho_prep_info_r8_ies_s& ho_prep,
const asn1::s1ap::ho_request_s& ho_req_msg)
{
const cell_ctxt_dedicated* target_cell = rrc_ue->cell_ded_list.get_ue_cc_idx(UE_PCELL_CC_IDX);
const ue_cell_ded* target_cell = rrc_ue->ue_cell_list.get_ue_cc_idx(UE_PCELL_CC_IDX);
const cell_cfg_t& target_cell_cfg = target_cell->cell_common->cell_cfg;
// Establish ERABs/DRBs
@ -779,7 +779,7 @@ bool rrc::ue::rrc_mobility::apply_ho_prep_cfg(const ho_prep_info_r8_ies_s& ho
void rrc::ue::rrc_mobility::handle_recfg_complete(wait_recfg_comp& s, const recfg_complete_ev& ev)
{
cell_ctxt_dedicated* target_cell = rrc_ue->cell_ded_list.get_ue_cc_idx(UE_PCELL_CC_IDX);
ue_cell_ded* target_cell = rrc_ue->ue_cell_list.get_ue_cc_idx(UE_PCELL_CC_IDX);
rrc_log->info("User rnti=0x%x successfully handovered to cell_id=0x%x\n",
rrc_ue->rnti,
target_cell->cell_common->cell_cfg.cell_id);
@ -842,7 +842,7 @@ void rrc::ue::rrc_mobility::intraenb_ho_st::enter(rrc_mobility* f, const ho_meas
{
uint32_t cell_id = rrc_details::eci_to_cellid(meas_report.target_eci);
target_cell = f->rrc_enb->cell_common_list->get_cell_id(cell_id);
source_cell = f->rrc_ue->cell_ded_list.get_ue_cc_idx(UE_PCELL_CC_IDX)->cell_common;
source_cell = f->rrc_ue->ue_cell_list.get_ue_cc_idx(UE_PCELL_CC_IDX)->cell_common;
if (target_cell == nullptr) {
f->log_h->error("The target cell_id=0x%x was not found in the list of eNB cells\n", cell_id);
f->trigger(srslte::failure_ev{});
@ -858,7 +858,7 @@ void rrc::ue::rrc_mobility::intraenb_ho_st::enter(rrc_mobility* f, const ho_meas
last_temp_crnti = SRSLTE_INVALID_RNTI;
/* Allocate Resources in Target Cell */
if (not f->rrc_ue->cell_ded_list.set_cells({target_cell->enb_cc_idx})) {
if (not f->rrc_ue->ue_cell_list.set_cells({target_cell->enb_cc_idx})) {
f->trigger(srslte::failure_ev{});
return;
}

@ -42,14 +42,14 @@ rrc::ue::ue(rrc* outer_rrc, uint16_t rnti_, const sched_interface::ue_cfg_t& sch
rnti(rnti_),
pool(srslte::byte_buffer_pool::get_instance()),
phy_rrc_dedicated_list(sched_ue_cfg.supported_cc_list.size()),
cell_ded_list(parent->cfg, *outer_rrc->cell_res_list, *outer_rrc->cell_common_list),
ue_cell_list(parent->cfg, *outer_rrc->cell_res_list, *outer_rrc->cell_common_list),
bearer_list(rnti_, parent->cfg),
ue_security_cfg(parent->cfg)
{
mac_ctrl.reset(new mac_controller{this, sched_ue_cfg});
// Allocate cell and PUCCH resources
if (cell_ded_list.add_cell(sched_ue_cfg.supported_cc_list[0].enb_cc_idx) == nullptr) {
if (ue_cell_list.add_cell(sched_ue_cfg.supported_cc_list[0].enb_cc_idx) == nullptr) {
return;
}
@ -258,7 +258,7 @@ void rrc::ue::send_connection_setup()
rr_cfg_ded_s& rr_cfg = setup_r8.rr_cfg_ded;
// Fill RR config dedicated
fill_rr_cfg_ded_setup(rr_cfg, parent->cfg, cell_ded_list);
fill_rr_cfg_ded_setup(rr_cfg, parent->cfg, ue_cell_list);
// Apply ConnectionSetup Configuration to MAC scheduler
mac_ctrl->handle_con_setup(setup_r8);
@ -330,11 +330,11 @@ void rrc::ue::handle_rrc_con_reest_req(rrc_conn_reest_request_s* msg)
if (is_idle()) {
uint16_t old_rnti = msg->crit_exts.rrc_conn_reest_request_r8().ue_id.c_rnti.to_number();
uint16_t old_pci = msg->crit_exts.rrc_conn_reest_request_r8().ue_id.pci;
const cell_info_common* old_cell = parent->cell_common_list->get_pci(old_pci);
const enb_cell_common* old_cell = parent->cell_common_list->get_pci(old_pci);
auto ue_it = parent->users.find(old_rnti);
// Reject unrecognized rntis, and PCIs that do not belong to eNB
if (ue_it != parent->users.end() and old_cell != nullptr and
ue_it->second->cell_ded_list.get_enb_cc_idx(old_cell->enb_cc_idx) != nullptr) {
ue_it->second->ue_cell_list.get_enb_cc_idx(old_cell->enb_cc_idx) != nullptr) {
parent->rrc_log->info("ConnectionReestablishmentRequest for rnti=0x%x. Sending Connection Reestablishment\n",
old_rnti);
@ -342,7 +342,7 @@ void rrc::ue::handle_rrc_con_reest_req(rrc_conn_reest_request_s* msg)
parent->users[old_rnti]->mobility_handler->trigger(rrc_mobility::ho_cancel_ev{});
// Recover security setup
const cell_info_common* pcell_cfg = get_ue_cc_cfg(UE_PCELL_CC_IDX);
const enb_cell_common* pcell_cfg = get_ue_cc_cfg(UE_PCELL_CC_IDX);
ue_security_cfg = parent->users[old_rnti]->ue_security_cfg;
ue_security_cfg.regenerate_keys_handover(pcell_cfg->cell_cfg.pci, pcell_cfg->cell_cfg.dl_earfcn);
@ -396,7 +396,7 @@ void rrc::ue::send_connection_reest(uint8_t ncc)
rr_cfg_ded_s& rr_cfg = reest_r8.rr_cfg_ded;
// Fill RR config dedicated
fill_rr_cfg_ded_setup(rr_cfg, parent->cfg, cell_ded_list);
fill_rr_cfg_ded_setup(rr_cfg, parent->cfg, ue_cell_list);
// Set NCC
reest_r8.next_hop_chaining_count = ncc;
@ -479,8 +479,7 @@ void rrc::ue::send_connection_reconf(srslte::unique_byte_buffer_t pdu, bool phy_
// Fill RR Config Ded and SCells
apply_reconf_updates(recfg_r8,
current_ue_cfg,
parent->cfg,
cell_ded_list,
parent->cfg, ue_cell_list,
bearer_list,
ue_capabilities,
phy_cfg_updated);
@ -856,21 +855,21 @@ void rrc::ue::notify_s1ap_ue_erab_setup_response(const asn1::s1ap::erab_to_be_se
}
//! Helper method to access Cell configuration based on UE Carrier Index
cell_info_common* rrc::ue::get_ue_cc_cfg(uint32_t ue_cc_idx)
enb_cell_common* rrc::ue::get_ue_cc_cfg(uint32_t ue_cc_idx)
{
if (ue_cc_idx >= cell_ded_list.nof_cells()) {
if (ue_cc_idx >= ue_cell_list.nof_cells()) {
return nullptr;
}
uint32_t enb_cc_idx = cell_ded_list.get_ue_cc_idx(ue_cc_idx)->cell_common->enb_cc_idx;
uint32_t enb_cc_idx = ue_cell_list.get_ue_cc_idx(ue_cc_idx)->cell_common->enb_cc_idx;
return parent->cell_common_list->get_cc_idx(enb_cc_idx);
}
void rrc::ue::update_scells()
{
const cell_ctxt_dedicated* pcell = cell_ded_list.get_ue_cc_idx(UE_PCELL_CC_IDX);
const cell_info_common* pcell_cfg = pcell->cell_common;
const ue_cell_ded* pcell = ue_cell_list.get_ue_cc_idx(UE_PCELL_CC_IDX);
const enb_cell_common* pcell_cfg = pcell->cell_common;
if (cell_ded_list.nof_cells() == pcell_cfg->scells.size() + 1) {
if (ue_cell_list.nof_cells() == pcell_cfg->scells.size() + 1) {
// SCells already added
return;
}
@ -885,8 +884,8 @@ void rrc::ue::update_scells()
return;
}
for (const cell_info_common* scell : pcell_cfg->scells) {
cell_ded_list.add_cell(scell->enb_cc_idx);
for (const enb_cell_common* scell : pcell_cfg->scells) {
ue_cell_list.add_cell(scell->enb_cc_idx);
}
parent->rrc_log->info("SCells activated for rnti=0x%x\n", rnti);
@ -1029,9 +1028,9 @@ void rrc::ue::apply_reconf_phy_config(const rrc_conn_recfg_r8_ies_s& reconfig_r8
// Handle Add/Modify SCell list
if (reconfig_r1020.scell_to_add_mod_list_r10_present) {
auto& list = reconfig_r1020.scell_to_add_mod_list_r10;
phy_rrc_dedicated_list.resize(cell_ded_list.nof_cells());
phy_rrc_dedicated_list.resize(ue_cell_list.nof_cells());
for (const scell_to_add_mod_r10_s& scell : list) {
cell_ctxt_dedicated* ue_cc = cell_ded_list.get_ue_cc_idx(scell.scell_idx_r10);
ue_cell_ded* ue_cc = ue_cell_list.get_ue_cc_idx(scell.scell_idx_r10);
// Create new PHY configuration structure for this SCell
phy_interface_rrc_lte::phy_rrc_cfg_t scell_phy_rrc_ded = {};
srslte::set_phy_cfg_t_scell_config(&scell_phy_rrc_ded.phy_cfg, scell);
@ -1140,7 +1139,7 @@ void rrc::ue::apply_rlc_rb_updates(const rr_cfg_ded_s& pending_rr_cfg)
int rrc::ue::get_cqi(uint16_t* pmi_idx, uint16_t* n_pucch, uint32_t ue_cc_idx)
{
cell_ctxt_dedicated* c = cell_ded_list.get_ue_cc_idx(ue_cc_idx);
ue_cell_ded* c = ue_cell_list.get_ue_cc_idx(ue_cc_idx);
if (c != nullptr and c->cqi_res_present) {
*pmi_idx = c->cqi_res.pmi_idx;
*n_pucch = c->cqi_res.pucch_res;
@ -1153,7 +1152,7 @@ int rrc::ue::get_cqi(uint16_t* pmi_idx, uint16_t* n_pucch, uint32_t ue_cc_idx)
bool rrc::ue::is_allocated() const
{
return cell_ded_list.is_allocated();
return ue_cell_list.is_allocated();
}
int rrc::ue::get_ri(uint32_t m_ri, uint16_t* ri_idx)

@ -246,7 +246,7 @@ void compute_diff_meas_ids(const meas_cfg_s& src_cfg, const meas_cfg_s& target_c
meas_cfg.meas_id_to_rem_list_present = meas_cfg.meas_id_to_rem_list.size() > 0;
}
meas_gap_cfg_c make_measgap(const meas_obj_list& measobjs, const cell_ctxt_dedicated& pcell)
meas_gap_cfg_c make_measgap(const meas_obj_list& measobjs, const ue_cell_ded& pcell)
{
meas_gap_cfg_c meas_gap;
if (measobjs.size() == 1) {
@ -330,22 +330,22 @@ bool set_meascfg_presence_flags(meas_cfg_s& meascfg)
meascfg.meas_gap_cfg_present;
}
bool fill_meascfg_enb_cfg(meas_cfg_s& meascfg, const cell_ctxt_dedicated_list& ue_cell_list)
bool fill_meascfg_enb_cfg(meas_cfg_s& meascfg, const ue_cell_ded_list& ue_cell_list)
{
const cell_ctxt_dedicated* pcell = ue_cell_list.get_ue_cc_idx(UE_PCELL_CC_IDX);
const ue_cell_ded* pcell = ue_cell_list.get_ue_cc_idx(UE_PCELL_CC_IDX);
assert(pcell != nullptr);
const cell_info_common* pcell_cfg = pcell->cell_common;
const enb_cell_common* pcell_cfg = pcell->cell_common;
const auto& pcell_meascfg = pcell_cfg->cell_cfg.meas_cfg;
// Add PCell+Scells to measObjToAddModList
// NOTE: sort by EARFCN to avoid unnecessary reconfigurations of measObjToAddModList
std::vector<const cell_ctxt_dedicated*> sorted_ue_cells(ue_cell_list.nof_cells());
std::vector<const ue_cell_ded*> sorted_ue_cells(ue_cell_list.nof_cells());
for (uint32_t ue_cc_idx = 0; ue_cc_idx < ue_cell_list.nof_cells(); ++ue_cc_idx) {
sorted_ue_cells[ue_cc_idx] = ue_cell_list.get_ue_cc_idx(ue_cc_idx);
}
std::sort(sorted_ue_cells.begin(),
sorted_ue_cells.end(),
[](const cell_ctxt_dedicated* cc1, const cell_ctxt_dedicated* cc2) {
[](const ue_cell_ded* cc1, const ue_cell_ded* cc2) {
return cc1->get_dl_earfcn() < cc2->get_dl_earfcn();
});
for (auto* cc : sorted_ue_cells) {
@ -411,13 +411,13 @@ bool compute_diff_meascfg(const meas_cfg_s& current_meascfg, const meas_cfg_s& t
bool apply_meascfg_updates(meas_cfg_s& meascfg,
meas_cfg_s& current_meascfg,
const cell_ctxt_dedicated_list& ue_cell_list,
const ue_cell_ded_list& ue_cell_list,
int prev_earfcn,
int prev_pci)
{
meascfg = {};
const cell_ctxt_dedicated* pcell = ue_cell_list.get_ue_cc_idx(UE_PCELL_CC_IDX);
const ue_cell_ded* pcell = ue_cell_list.get_ue_cc_idx(UE_PCELL_CC_IDX);
uint32_t target_earfcn = pcell->get_dl_earfcn();
if (static_cast<uint32_t>(prev_pci) == pcell->get_pci() and static_cast<uint32_t>(prev_earfcn) == target_earfcn) {

@ -75,7 +75,7 @@ void fill_srbs_reconf(srb_to_add_mod_list_l& srbs, const srb_to_add_mod_list_l&
* SR Config
*****************************/
void fill_sr_cfg_setup(sched_request_cfg_c& sr_cfg, const cell_ctxt_dedicated_list& ue_cell_list)
void fill_sr_cfg_setup(sched_request_cfg_c& sr_cfg, const ue_cell_ded_list& ue_cell_list)
{
auto& setup = sr_cfg.setup();
setup.sr_cfg_idx = ue_cell_list.get_sr_res()->sr_I;
@ -138,13 +138,13 @@ void fill_cqi_report_enb_cfg(cqi_report_cfg_s& cqi_report_cfg, const rrc_cfg_t&
int fill_cqi_report_setup(cqi_report_cfg_s& cqi_rep,
const rrc_cfg_t& enb_cfg,
const cell_ctxt_dedicated_list& ue_cell_list)
const ue_cell_ded_list& ue_cell_list)
{
// eNB params set at this point
// For Periodic CQI, set PUCCH resources
if (cqi_rep.cqi_report_periodic_present) {
const cell_ctxt_dedicated* pcell = ue_cell_list.get_ue_cc_idx(UE_PCELL_CC_IDX);
const ue_cell_ded* pcell = ue_cell_list.get_ue_cc_idx(UE_PCELL_CC_IDX);
if (pcell == nullptr or not pcell->cqi_res_present) {
srslte::logmap::get("RRC")->warning("PCell CQI resources haven\'t been allocated yet\n");
return SRSLTE_ERROR;
@ -159,7 +159,7 @@ int fill_cqi_report_setup(cqi_report_cfg_s& cqi_rep,
void fill_cqi_report_reconf(cqi_report_cfg_s& cqi_rep,
const rrc_cfg_t& enb_cfg,
const cell_ctxt_dedicated_list& ue_cell_list)
const ue_cell_ded_list& ue_cell_list)
{
// Get RRC setup CQI config
if (fill_cqi_report_setup(cqi_rep, enb_cfg, ue_cell_list) == SRSLTE_ERROR) {
@ -240,7 +240,7 @@ void fill_phy_cfg_ded_enb_cfg(phys_cfg_ded_s& phy_cfg, const rrc_cfg_t& enb_cfg)
void fill_phy_cfg_ded_setup(phys_cfg_ded_s& phy_cfg,
const rrc_cfg_t& enb_cfg,
const cell_ctxt_dedicated_list& ue_cell_list)
const ue_cell_ded_list& ue_cell_list)
{
// Set PHYConfigDedicated base
fill_phy_cfg_ded_enb_cfg(phy_cfg, enb_cfg);
@ -255,7 +255,7 @@ void fill_phy_cfg_ded_setup(phys_cfg_ded_s& phy_cfg,
/// Fills ASN1 PhysicalConfigurationDedicated struct with eNB config params at RRCReconf
void fill_phy_cfg_ded_reconf(phys_cfg_ded_s& phy_cfg,
const rrc_cfg_t& enb_cfg,
const cell_ctxt_dedicated_list& ue_cell_list,
const ue_cell_ded_list& ue_cell_list,
const srslte::rrc_ue_capabilities_t& ue_caps)
{
// Use RRCSetup as starting point
@ -307,7 +307,7 @@ void fill_rr_cfg_ded_enb_cfg(asn1::rrc::rr_cfg_ded_s& rr_cfg, const rrc_cfg_t& e
void fill_rr_cfg_ded_setup(asn1::rrc::rr_cfg_ded_s& rr_cfg,
const rrc_cfg_t& enb_cfg,
const cell_ctxt_dedicated_list& ue_cell_list)
const ue_cell_ded_list& ue_cell_list)
{
// Establish default enb config
fill_rr_cfg_ded_enb_cfg(rr_cfg, enb_cfg);
@ -324,7 +324,7 @@ void fill_rr_cfg_ded_setup(asn1::rrc::rr_cfg_ded_s& rr_cfg,
void fill_rr_cfg_ded_reconf(asn1::rrc::rr_cfg_ded_s& rr_cfg,
const rr_cfg_ded_s& current_rr_cfg,
const rrc_cfg_t& enb_cfg,
const cell_ctxt_dedicated_list& ue_cell_list,
const ue_cell_ded_list& ue_cell_list,
const bearer_cfg_handler& bearers,
const srslte::rrc_ue_capabilities_t& ue_caps,
bool phy_cfg_updated)
@ -398,7 +398,7 @@ void apply_rr_cfg_ded_diff(rr_cfg_ded_s& current_rr_cfg_ded, const rr_cfg_ded_s&
void fill_scells_reconf(asn1::rrc::rrc_conn_recfg_r8_ies_s& recfg_r8,
const scell_to_add_mod_list_r10_l& current_scells,
const rrc_cfg_t& enb_cfg,
const cell_ctxt_dedicated_list& ue_cell_list,
const ue_cell_ded_list& ue_cell_list,
const srslte::rrc_ue_capabilities_t& ue_caps)
{
// check whether there has been scell updates
@ -420,8 +420,8 @@ void fill_scells_reconf(asn1::rrc::rrc_conn_recfg_r8_ies_s& recfg_r8,
scell_to_add_mod_list_r10_l target_scells(ue_cell_list.nof_cells() - 1);
for (size_t ue_cc_idx = 1; ue_cc_idx < ue_cell_list.nof_cells(); ++ue_cc_idx) {
const cell_ctxt_dedicated& scell = *ue_cell_list.get_ue_cc_idx(ue_cc_idx);
const cell_info_common& scell_cfg = *scell.cell_common;
const ue_cell_ded& scell = *ue_cell_list.get_ue_cc_idx(ue_cc_idx);
const enb_cell_common& scell_cfg = *scell.cell_common;
const sib_type1_s& cell_sib1 = scell_cfg.sib1;
const sib_type2_s& cell_sib2 = scell_cfg.sib2;
@ -572,7 +572,7 @@ void apply_scells_to_add_diff(asn1::rrc::scell_to_add_mod_list_r10_l& current_sc
void apply_reconf_updates(asn1::rrc::rrc_conn_recfg_r8_ies_s& recfg_r8,
ue_var_cfg_t& current_ue_cfg,
const rrc_cfg_t& enb_cfg,
const cell_ctxt_dedicated_list& ue_cell_list,
const ue_cell_ded_list& ue_cell_list,
bearer_cfg_handler& bearers,
const srslte::rrc_ue_capabilities_t& ue_caps,
bool phy_cfg_updated)

@ -240,7 +240,7 @@ int test_correct_meascfg_calculation()
cfg.cell_list[0].meas_cfg.meas_reports[0] = generate_rep1();
// TEST: correct construction of list of cells
cell_info_common_list cell_list{cfg};
enb_cell_common_list cell_list{cfg};
TESTASSERT(cell_list.nof_cells() == 2);
TESTASSERT(cell_list.get_cc_idx(0)->scells.size() == 1);
TESTASSERT(cell_list.get_cc_idx(0)->scells[0] == cell_list.get_cc_idx(1));
@ -249,7 +249,7 @@ int test_correct_meascfg_calculation()
// measConfig only includes earfcns of active carriers for a given pcell
meas_cfg_s cell_meas_cfg;
cell_ctxt_dedicated_list ue_cell_list{cfg, freq_res, cell_list};
ue_cell_ded_list ue_cell_list{cfg, freq_res, cell_list};
ue_cell_list.set_cells({0});
TESTASSERT(fill_meascfg_enb_cfg(cell_meas_cfg, ue_cell_list));
const auto& measobjs = cell_meas_cfg.meas_obj_to_add_mod_list;
@ -300,14 +300,14 @@ int test_minimize_meascfg_reordering()
cfg1.cell_list[1].dl_earfcn = 3400;
cfg1.cell_list[1].cell_id = 0x02;
cell_info_common_list cell_list{cfg1};
enb_cell_common_list cell_list{cfg1};
TESTASSERT(cell_list.nof_cells() == 2);
TESTASSERT(cell_list.get_cc_idx(0)->scells.size() == 1);
TESTASSERT(cell_list.get_cc_idx(0)->scells[0] == cell_list.get_cc_idx(1));
TESTASSERT(cell_list.get_cc_idx(1)->scells.empty());
freq_res_common_list freq_res{cfg1};
cell_ctxt_dedicated_list ue_cell_list1{cfg1, freq_res, cell_list};
cell_ctxt_dedicated_list ue_cell_list2{cfg1, freq_res, cell_list};
ue_cell_ded_list ue_cell_list1{cfg1, freq_res, cell_list};
ue_cell_ded_list ue_cell_list2{cfg1, freq_res, cell_list};
meas_cfg_s mcfg1{}, mcfg2{};
ue_cell_list1.set_cells({0, 1});

Loading…
Cancel
Save