created separate cell ctxt common list

master
Francisco Paisana 5 years ago committed by Francisco Paisana
parent 94b8dd39a9
commit 4b525127c9

@ -22,9 +22,9 @@
#ifndef SRSENB_RRC_H #ifndef SRSENB_RRC_H
#define SRSENB_RRC_H #define SRSENB_RRC_H
#include "rrc_config.h"
#include "rrc_metrics.h" #include "rrc_metrics.h"
#include "srsenb/hdr/stack/upper/common_enb.h" #include "srsenb/hdr/stack/upper/common_enb.h"
#include "srslte/asn1/rrc_asn1.h"
#include "srslte/common/block_queue.h" #include "srslte/common/block_queue.h"
#include "srslte/common/buffer_pool.h" #include "srslte/common/buffer_pool.h"
#include "srslte/common/common.h" #include "srslte/common/common.h"
@ -32,64 +32,13 @@
#include "srslte/common/stack_procedure.h" #include "srslte/common/stack_procedure.h"
#include "srslte/common/timeout.h" #include "srslte/common/timeout.h"
#include "srslte/interfaces/enb_interfaces.h" #include "srslte/interfaces/enb_interfaces.h"
#include "srslte/interfaces/enb_rrc_interface_types.h"
#include <map> #include <map>
#include <queue> #include <queue>
namespace srsenb { namespace srsenb {
struct rrc_cfg_sr_t { class cell_ctxt_common;
uint32_t period; class cell_ctxt_common_list;
asn1::rrc::sched_request_cfg_c::setup_s_::dsr_trans_max_e_ dsr_max;
uint32_t nof_prb;
uint32_t sf_mapping[80];
uint32_t nof_subframes;
};
enum rrc_cfg_cqi_mode_t { RRC_CFG_CQI_MODE_PERIODIC = 0, RRC_CFG_CQI_MODE_APERIODIC, RRC_CFG_CQI_MODE_N_ITEMS };
static const char rrc_cfg_cqi_mode_text[RRC_CFG_CQI_MODE_N_ITEMS][20] = {"periodic", "aperiodic"};
typedef struct {
uint32_t sf_mapping[80];
uint32_t nof_subframes;
uint32_t nof_prb;
uint32_t period;
uint32_t m_ri;
bool simultaneousAckCQI;
rrc_cfg_cqi_mode_t mode;
} rrc_cfg_cqi_t;
typedef struct {
bool configured;
asn1::rrc::lc_ch_cfg_s::ul_specific_params_s_ lc_cfg;
asn1::rrc::pdcp_cfg_s pdcp_cfg;
asn1::rrc::rlc_cfg_c rlc_cfg;
} rrc_cfg_qci_t;
#define MAX_NOF_QCI 10
struct rrc_cfg_t {
uint32_t enb_id; ///< Required to pack SIB1
// Per eNB SIBs
asn1::rrc::sib_type1_s sib1;
asn1::rrc::sib_info_item_c sibs[ASN1_RRC_MAX_SIB];
asn1::rrc::mac_main_cfg_s mac_cnfg;
asn1::rrc::pusch_cfg_ded_s pusch_cfg;
asn1::rrc::ant_info_ded_s antenna_info;
asn1::rrc::pdsch_cfg_ded_s::p_a_e_ pdsch_cfg;
rrc_cfg_sr_t sr_cfg;
rrc_cfg_cqi_t cqi_cfg;
rrc_cfg_qci_t qci_cfg[MAX_NOF_QCI];
bool enable_mbsfn;
uint32_t inactivity_timeout_ms;
srslte::CIPHERING_ALGORITHM_ID_ENUM eea_preference_list[srslte::CIPHERING_ALGORITHM_ID_N_ITEMS];
srslte::INTEGRITY_ALGORITHM_ID_ENUM eia_preference_list[srslte::INTEGRITY_ALGORITHM_ID_N_ITEMS];
bool meas_cfg_present = false;
srslte_cell_t cell;
cell_list_t cell_list;
};
static const char rrc_state_text[RRC_STATE_N_ITEMS][100] = {"IDLE", static const char rrc_state_text[RRC_STATE_N_ITEMS][100] = {"IDLE",
"WAIT FOR CON SETUP COMPLETE", "WAIT FOR CON SETUP COMPLETE",
@ -158,17 +107,6 @@ public:
const std::string& msg_type); const std::string& msg_type);
private: private:
struct cell_ctxt_t {
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
cell_ctxt_t(uint32_t idx, const cell_cfg_t& cell_cfg);
};
class ue class ue
{ {
public: public:
@ -313,7 +251,7 @@ private:
// Struct to store the cell resources allocated to a user // Struct to store the cell resources allocated to a user
struct cell_res_ded_t { struct cell_res_ded_t {
const cell_ctxt_t* cell_common = nullptr; const cell_ctxt_common* cell_common = nullptr;
uint32_t pmi_idx = 0; uint32_t pmi_idx = 0;
uint32_t pucch_res = 0; uint32_t pucch_res = 0;
uint32_t prb_idx = 0; uint32_t prb_idx = 0;
@ -324,7 +262,7 @@ private:
int get_drbid_config(asn1::rrc::drb_to_add_mod_s* drb, int drbid); int get_drbid_config(asn1::rrc::drb_to_add_mod_s* drb, int drbid);
///< Helper to access a cell cfg based on ue_cc_idx ///< Helper to access a cell cfg based on ue_cc_idx
cell_ctxt_t* get_ue_cc_cfg(uint32_t ue_cc_idx); cell_ctxt_common* get_ue_cc_cfg(uint32_t ue_cc_idx);
///< Helper to fill SCell struct for RRR Connection Reconfig ///< Helper to fill SCell struct for RRR Connection Reconfig
int fill_scell_to_addmod_list(asn1::rrc::rrc_conn_recfg_r8_ies_s* conn_reconf); int fill_scell_to_addmod_list(asn1::rrc::rrc_conn_recfg_r8_ies_s* conn_reconf);
@ -378,14 +316,12 @@ private:
srslte::log_ref rrc_log; srslte::log_ref rrc_log;
// derived params // derived params
std::vector<std::unique_ptr<cell_ctxt_t> > cell_ctxt_list; std::unique_ptr<cell_ctxt_common_list> cell_ctxt_list;
// state // state
std::map<uint16_t, std::unique_ptr<ue> > users; // NOTE: has to have fixed addr std::map<uint16_t, std::unique_ptr<ue> > users; // NOTE: has to have fixed addr
std::map<uint32_t, asn1::rrc::paging_record_s> pending_paging; std::map<uint32_t, asn1::rrc::paging_record_s> pending_paging;
cell_ctxt_t* find_cell_ctxt(uint32_t cell_id);
void process_release_complete(uint16_t rnti); void process_release_complete(uint16_t rnti);
void process_rl_failure(uint16_t rnti); void process_rl_failure(uint16_t rnti);
void rem_user(uint16_t rnti); void rem_user(uint16_t rnti);

@ -0,0 +1,57 @@
/*
* Copyright 2013-2020 Software Radio Systems Limited
*
* This file is part of srsLTE.
*
* srsLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#ifndef SRSLTE_RRC_CELL_CFG_H
#define SRSLTE_RRC_CELL_CFG_H
#include "rrc_config.h"
namespace srsenb {
struct cell_ctxt_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<std::vector<uint8_t> > sib_buffer; ///< Packed SIBs for given CC
cell_ctxt_common(uint32_t idx_, const cell_cfg_t& cfg) : enb_cc_idx(idx_), cell_cfg(cfg) {}
};
class cell_ctxt_common_list
{
public:
explicit cell_ctxt_common_list(const rrc_cfg_t& cfg_);
cell_ctxt_common* get_cc_idx(uint32_t enb_cc_idx) { return &cell_list[enb_cc_idx]; }
cell_ctxt_common* get_cell_id(uint32_t cell_id);
cell_ctxt_common* get_pci(uint32_t pci);
size_t nof_cells() const { return cell_list.size(); }
private:
const rrc_cfg_t& cfg;
std::vector<cell_ctxt_common> cell_list;
};
} // namespace srsenb
#endif // SRSLTE_RRC_CELL_CFG_H

@ -0,0 +1,86 @@
/*
* Copyright 2013-2020 Software Radio Systems Limited
*
* This file is part of srsLTE.
*
* srsLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#ifndef SRSLTE_RRC_CONFIG_H
#define SRSLTE_RRC_CONFIG_H
#include "srslte/asn1/rrc_asn1.h"
#include "srslte/common/security.h"
#include "srslte/interfaces/enb_rrc_interface_types.h"
namespace srsenb {
struct rrc_cfg_sr_t {
uint32_t period;
asn1::rrc::sched_request_cfg_c::setup_s_::dsr_trans_max_e_ dsr_max;
uint32_t nof_prb;
uint32_t sf_mapping[80];
uint32_t nof_subframes;
};
enum rrc_cfg_cqi_mode_t { RRC_CFG_CQI_MODE_PERIODIC = 0, RRC_CFG_CQI_MODE_APERIODIC, RRC_CFG_CQI_MODE_N_ITEMS };
static const char rrc_cfg_cqi_mode_text[RRC_CFG_CQI_MODE_N_ITEMS][20] = {"periodic", "aperiodic"};
typedef struct {
uint32_t sf_mapping[80];
uint32_t nof_subframes;
uint32_t nof_prb;
uint32_t period;
uint32_t m_ri;
bool simultaneousAckCQI;
rrc_cfg_cqi_mode_t mode;
} rrc_cfg_cqi_t;
typedef struct {
bool configured;
asn1::rrc::lc_ch_cfg_s::ul_specific_params_s_ lc_cfg;
asn1::rrc::pdcp_cfg_s pdcp_cfg;
asn1::rrc::rlc_cfg_c rlc_cfg;
} rrc_cfg_qci_t;
#define MAX_NOF_QCI 10
struct rrc_cfg_t {
uint32_t enb_id; ///< Required to pack SIB1
// Per eNB SIBs
asn1::rrc::sib_type1_s sib1;
asn1::rrc::sib_info_item_c sibs[ASN1_RRC_MAX_SIB];
asn1::rrc::mac_main_cfg_s mac_cnfg;
asn1::rrc::pusch_cfg_ded_s pusch_cfg;
asn1::rrc::ant_info_ded_s antenna_info;
asn1::rrc::pdsch_cfg_ded_s::p_a_e_ pdsch_cfg;
rrc_cfg_sr_t sr_cfg;
rrc_cfg_cqi_t cqi_cfg;
rrc_cfg_qci_t qci_cfg[MAX_NOF_QCI];
bool enable_mbsfn;
uint32_t inactivity_timeout_ms;
srslte::CIPHERING_ALGORITHM_ID_ENUM eea_preference_list[srslte::CIPHERING_ALGORITHM_ID_N_ITEMS];
srslte::INTEGRITY_ALGORITHM_ID_ENUM eia_preference_list[srslte::INTEGRITY_ALGORITHM_ID_N_ITEMS];
bool meas_cfg_present = false;
srslte_cell_t cell;
cell_list_t cell_list;
};
} // namespace srsenb
#endif // SRSLTE_RRC_CONFIG_H

@ -18,5 +18,5 @@
# and at http://www.gnu.org/licenses/. # and at http://www.gnu.org/licenses/.
# #
set(SOURCES rrc.cc rrc_mobility.cc) set(SOURCES rrc.cc rrc_mobility.cc rrc_cell_cfg.cc)
add_library(srsenb_rrc STATIC ${SOURCES}) add_library(srsenb_rrc STATIC ${SOURCES})

@ -20,6 +20,7 @@
*/ */
#include "srsenb/hdr/stack/rrc/rrc.h" #include "srsenb/hdr/stack/rrc/rrc.h"
#include "srsenb/hdr/stack/rrc/rrc_cell_cfg.h"
#include "srsenb/hdr/stack/rrc/rrc_mobility.h" #include "srsenb/hdr/stack/rrc/rrc_mobility.h"
#include "srslte/asn1/asn1_utils.h" #include "srslte/asn1/asn1_utils.h"
#include "srslte/asn1/rrc_asn1_utils.h" #include "srslte/asn1/rrc_asn1_utils.h"
@ -114,8 +115,8 @@ void rrc::get_metrics(rrc_metrics_t& m)
uint8_t* rrc::read_pdu_bcch_dlsch(const uint8_t cc_idx, const uint32_t sib_index) uint8_t* rrc::read_pdu_bcch_dlsch(const uint8_t cc_idx, const uint32_t sib_index)
{ {
if (sib_index < ASN1_RRC_MAX_SIB && cc_idx < cell_ctxt_list.size()) { if (sib_index < ASN1_RRC_MAX_SIB && cc_idx < cell_ctxt_list->nof_cells()) {
return cell_ctxt_list.at(cc_idx)->sib_buffer.at(sib_index)->msg; return &cell_ctxt_list->get_cc_idx(cc_idx)->sib_buffer.at(sib_index)[0];
} }
return nullptr; return nullptr;
} }
@ -687,15 +688,6 @@ void rrc::process_rl_failure(uint16_t rnti)
} }
} }
///< Helper method to get cell ctxt based on id
rrc::cell_ctxt_t* rrc::find_cell_ctxt(uint32_t cell_id)
{
auto it = std::find_if(cell_ctxt_list.begin(),
cell_ctxt_list.end(),
[cell_id](const std::unique_ptr<cell_ctxt_t>& c) { return cell_id == c->cell_cfg.cell_id; });
return (it == cell_ctxt_list.end()) ? nullptr : it->get();
}
///< User mutex must be hold by caller ///< User mutex must be hold by caller
void rrc::process_release_complete(uint16_t rnti) void rrc::process_release_complete(uint16_t rnti)
{ {
@ -750,7 +742,7 @@ void rrc::config_mac()
// set sib/prach cfg // set sib/prach cfg
for (uint32_t i = 0; i < nof_si_messages; i++) { for (uint32_t i = 0; i < nof_si_messages; i++) {
item.sibs[i].len = cell_ctxt_list.at(ccidx)->sib_buffer.at(i)->N_bytes; item.sibs[i].len = cell_ctxt_list->get_cc_idx(ccidx)->sib_buffer.at(i).size();
if (i == 0) { if (i == 0) {
item.sibs[i].period_rf = 8; // SIB1 is always 8 rf item.sibs[i].period_rf = 8; // SIB1 is always 8 rf
} else { } else {
@ -810,44 +802,18 @@ uint32_t rrc::generate_sibs()
uint32_t nof_messages = 1 + cfg.sib1.sched_info_list.size(); uint32_t nof_messages = 1 + cfg.sib1.sched_info_list.size();
sched_info_list_l& sched_info = cfg.sib1.sched_info_list; sched_info_list_l& sched_info = cfg.sib1.sched_info_list;
// Store in cell_ctxt_list, the SIB cfg of each carrier // Store configs,SIBs in common cell ctxt list
for (uint32_t cc_idx = 0; cc_idx < cfg.cell_list.size(); cc_idx++) { cell_ctxt_list.reset(new cell_ctxt_common_list{cfg});
cell_ctxt_list.push_back(std::unique_ptr<cell_ctxt_t>(new cell_ctxt_t{cc_idx, cfg.cell_list[cc_idx]}));
cell_ctxt_t& cell_ctxt = *cell_ctxt_list.back();
// Set Cell MIB
asn1::number_to_enum(cell_ctxt.mib.dl_bw, cfg.cell.nof_prb);
cell_ctxt.mib.phich_cfg.phich_res.value = (phich_cfg_s::phich_res_opts::options)cfg.cell.phich_resources;
cell_ctxt.mib.phich_cfg.phich_dur.value = (phich_cfg_s::phich_dur_opts::options)cfg.cell.phich_length;
// Set Cell SIB1
cell_ctxt.sib1 = cfg.sib1;
// Update cellId
sib_type1_s::cell_access_related_info_s_* cell_access = &cell_ctxt.sib1.cell_access_related_info;
cell_access->cell_id.from_number((cfg.enb_id << 8u) + cell_ctxt.cell_cfg.cell_id);
cell_access->tac.from_number(cell_ctxt.cell_cfg.tac);
// Update DL EARFCN
cell_ctxt.sib1.freq_band_ind = (uint8_t)srslte_band_get_band(cell_ctxt.cell_cfg.dl_earfcn);
// Set Cell SIB2
// update PRACH root seq index for this cell
cell_ctxt.sib2 = cfg.sibs[1].sib2();
cell_ctxt.sib2.rr_cfg_common.prach_cfg.root_seq_idx = cell_ctxt.cell_cfg.root_seq_idx;
// update carrier freq
if (cell_ctxt.sib2.freq_info.ul_carrier_freq_present) {
cell_ctxt.sib2.freq_info.ul_carrier_freq = cell_ctxt.cell_cfg.ul_earfcn;
}
}
// generate and pack into SIB buffers // generate and pack into SIB buffers
for (uint32_t cc_idx = 0; cc_idx < cfg.cell_list.size(); cc_idx++) { for (uint32_t cc_idx = 0; cc_idx < cfg.cell_list.size(); cc_idx++) {
cell_ctxt_t& cell_ctxt = *cell_ctxt_list[cc_idx]; cell_ctxt_common* cell_ctxt = cell_ctxt_list->get_cc_idx(cc_idx);
// msg is array of SI messages, each SI message msg[i] may contain multiple SIBs // 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 // all SIBs in a SI message msg[i] share the same periodicity
asn1::dyn_array<bcch_dl_sch_msg_s> msg(nof_messages + 1); asn1::dyn_array<bcch_dl_sch_msg_s> msg(nof_messages + 1);
// Copy SIB1 to first SI message // Copy SIB1 to first SI message
msg[0].msg.set_c1().set_sib_type1() = cell_ctxt.sib1; msg[0].msg.set_c1().set_sib_type1() = cell_ctxt->sib1;
// Copy rest of SIBs // Copy rest of SIBs
for (uint32_t sched_info_elem = 0; sched_info_elem < nof_messages - 1; sched_info_elem++) { for (uint32_t sched_info_elem = 0; sched_info_elem < nof_messages - 1; sched_info_elem++) {
@ -860,7 +826,7 @@ uint32_t rrc::generate_sibs()
// SIB2 always in second SI message // SIB2 always in second SI message
if (msg_index == 1) { if (msg_index == 1) {
sib_info_item_c sibitem; sib_info_item_c sibitem;
sibitem.set_sib2() = cell_ctxt.sib2; sibitem.set_sib2() = cell_ctxt->sib2;
sib_list.push_back(sibitem); sib_list.push_back(sibitem);
} }
@ -872,22 +838,17 @@ uint32_t rrc::generate_sibs()
// Pack payload for all messages // Pack payload for all messages
for (uint32_t msg_index = 0; msg_index < nof_messages; msg_index++) { for (uint32_t msg_index = 0; msg_index < nof_messages; msg_index++) {
srslte::unique_byte_buffer_t sib = srslte::allocate_unique_buffer(*pool); srslte::unique_byte_buffer_t sib_buffer = srslte::allocate_unique_buffer(*pool);
asn1::bit_ref bref(sib->msg, sib->get_tailroom()); asn1::bit_ref bref(sib_buffer->msg, sib_buffer->get_tailroom());
if (msg[msg_index].pack(bref) == asn1::SRSASN_ERROR_ENCODE_FAIL) { if (msg[msg_index].pack(bref) == asn1::SRSASN_ERROR_ENCODE_FAIL) {
rrc_log->error("Failed to pack SIB message %d\n", msg_index); rrc_log->error("Failed to pack SIB message %d\n", msg_index);
} }
sib->N_bytes = bref.distance_bytes(); sib_buffer->N_bytes = bref.distance_bytes();
cell_ctxt->sib_buffer.emplace_back(sib_buffer->msg, sib_buffer->msg + sib_buffer->N_bytes);
cell_ctxt.sib_buffer.push_back(std::move(sib));
// Log SIBs in JSON format // Log SIBs in JSON format
std::string log_msg("CC" + std::to_string(cc_idx) + " SIB payload"); std::string log_msg("CC" + std::to_string(cc_idx) + " SIB payload");
log_rrc_message(log_msg, log_rrc_message(log_msg, Tx, sib_buffer.get(), msg[msg_index], msg[msg_index].msg.c1().type().to_string());
Tx,
cell_ctxt.sib_buffer.at(msg_index).get(),
msg[msg_index],
msg[msg_index].msg.c1().type().to_string());
} }
if (cfg.sibs[6].type() == asn1::rrc::sys_info_r8_ies_s::sib_type_and_info_item_c_::types::sib7) { if (cfg.sibs[6].type() == asn1::rrc::sys_info_r8_ies_s::sib_type_and_info_item_c_::types::sib7) {
@ -1958,19 +1919,19 @@ void rrc::ue::send_connection_reconf(srslte::unique_byte_buffer_t pdu)
} }
//! Helper method to access Cell configuration based on UE Carrier Index //! Helper method to access Cell configuration based on UE Carrier Index
rrc::cell_ctxt_t* rrc::ue::get_ue_cc_cfg(uint32_t ue_cc_idx) cell_ctxt_common* rrc::ue::get_ue_cc_cfg(uint32_t ue_cc_idx)
{ {
if (ue_cc_idx >= current_sched_ue_cfg.supported_cc_list.size()) { if (ue_cc_idx >= current_sched_ue_cfg.supported_cc_list.size()) {
return nullptr; return nullptr;
} }
uint32_t enb_cc_idx = current_sched_ue_cfg.supported_cc_list[ue_cc_idx].enb_cc_idx; uint32_t enb_cc_idx = current_sched_ue_cfg.supported_cc_list[ue_cc_idx].enb_cc_idx;
return parent->cell_ctxt_list[enb_cc_idx].get(); return parent->cell_ctxt_list->get_cc_idx(enb_cc_idx);
} }
//! Method to fill SCellToAddModList for SCell info //! Method to fill SCellToAddModList for SCell info
int rrc::ue::fill_scell_to_addmod_list(asn1::rrc::rrc_conn_recfg_r8_ies_s* conn_reconf) int rrc::ue::fill_scell_to_addmod_list(asn1::rrc::rrc_conn_recfg_r8_ies_s* conn_reconf)
{ {
const cell_ctxt_t* pcell_cfg = get_ue_cc_cfg(UE_PCELL_CC_IDX); const cell_ctxt_common* pcell_cfg = get_ue_cc_cfg(UE_PCELL_CC_IDX);
if (pcell_cfg->cell_cfg.scell_list.empty()) { if (pcell_cfg->cell_cfg.scell_list.empty()) {
return SRSLTE_SUCCESS; return SRSLTE_SUCCESS;
} }
@ -1996,7 +1957,7 @@ int rrc::ue::fill_scell_to_addmod_list(asn1::rrc::rrc_conn_recfg_r8_ies_s* conn_
continue; continue;
} }
uint32_t scell_idx = p.first; uint32_t scell_idx = p.first;
const cell_ctxt_t* cc_cfg = p.second.cell_common; const cell_ctxt_common* cc_cfg = p.second.cell_common;
const sib_type1_s& cell_sib1 = cc_cfg->sib1; const sib_type1_s& cell_sib1 = cc_cfg->sib1;
const sib_type2_s& cell_sib2 = cc_cfg->sib2; const sib_type2_s& cell_sib2 = cc_cfg->sib2;
@ -2718,13 +2679,8 @@ int rrc::ue::cqi_allocate(uint32_t period, uint32_t ue_cc_idx)
if (ue_cc_idx == UE_PCELL_CC_IDX) { if (ue_cc_idx == UE_PCELL_CC_IDX) {
cell_res_list[ue_cc_idx].cell_common = get_ue_cc_cfg(UE_PCELL_CC_IDX); cell_res_list[ue_cc_idx].cell_common = get_ue_cc_cfg(UE_PCELL_CC_IDX);
} else { } else {
const auto& l = parent->cell_ctxt_list;
uint32_t cell_id = get_ue_cc_cfg(UE_PCELL_CC_IDX)->cell_cfg.scell_list[ue_cc_idx - 1].cell_id; uint32_t cell_id = get_ue_cc_cfg(UE_PCELL_CC_IDX)->cell_cfg.scell_list[ue_cc_idx - 1].cell_id;
// search for cell based on cell_id cell_res_list[ue_cc_idx].cell_common = parent->cell_ctxt_list->get_cell_id(cell_id);
auto it = std::find_if(l.begin(), l.end(), [cell_id](const std::unique_ptr<cell_ctxt_t>& c) {
return c->cell_cfg.cell_id == cell_id;
});
cell_res_list[ue_cc_idx].cell_common = it->get();
} }
parent->rrc_log->info( parent->rrc_log->info(
@ -2788,6 +2744,4 @@ int rrc::ue::get_ri(uint32_t m_ri, uint16_t* ri_idx)
return ret; return ret;
} }
rrc::cell_ctxt_t::cell_ctxt_t(uint32_t idx, const cell_cfg_t& cell_cfg_) : enb_cc_idx(idx), cell_cfg(cell_cfg_) {}
} // namespace srsenb } // namespace srsenb

@ -0,0 +1,77 @@
/*
* Copyright 2013-2020 Software Radio Systems Limited
*
* This file is part of srsLTE.
*
* srsLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#include "srsenb/hdr/stack/rrc/rrc_cell_cfg.h"
using namespace asn1::rrc;
namespace srsenb {
cell_ctxt_common_list::cell_ctxt_common_list(const rrc_cfg_t& cfg_) : cfg(cfg_)
{
cell_list.reserve(cfg.cell_list.size());
// Store the SIB cfg of each carrier
for (size_t ccidx = 0; ccidx < cfg.cell_list.size(); ++ccidx) {
cell_list.emplace_back(ccidx, cfg.cell_list[ccidx]);
auto& cell_ctxt = cell_list.back();
// Set Cell MIB
asn1::number_to_enum(cell_ctxt.mib.dl_bw, cfg.cell.nof_prb);
cell_ctxt.mib.phich_cfg.phich_res.value = (phich_cfg_s::phich_res_opts::options)cfg.cell.phich_resources;
cell_ctxt.mib.phich_cfg.phich_dur.value = (phich_cfg_s::phich_dur_opts::options)cfg.cell.phich_length;
// Set Cell SIB1
cell_ctxt.sib1 = cfg.sib1;
// Update cellId
sib_type1_s::cell_access_related_info_s_* cell_access = &cell_ctxt.sib1.cell_access_related_info;
cell_access->cell_id.from_number((cfg.enb_id << 8u) + cell_ctxt.cell_cfg.cell_id);
cell_access->tac.from_number(cell_ctxt.cell_cfg.tac);
// Update DL EARFCN
cell_ctxt.sib1.freq_band_ind = (uint8_t)srslte_band_get_band(cell_ctxt.cell_cfg.dl_earfcn);
// Set Cell SIB2
// update PRACH root seq index for this cell
cell_ctxt.sib2 = cfg.sibs[1].sib2();
cell_ctxt.sib2.rr_cfg_common.prach_cfg.root_seq_idx = cell_ctxt.cell_cfg.root_seq_idx;
// update carrier freq
if (cell_ctxt.sib2.freq_info.ul_carrier_freq_present) {
cell_ctxt.sib2.freq_info.ul_carrier_freq = cell_ctxt.cell_cfg.ul_earfcn;
}
}
}
cell_ctxt_common* cell_ctxt_common_list::get_cell_id(uint32_t cell_id)
{
auto it = std::find_if(cell_list.begin(), cell_list.end(), [cell_id](const cell_ctxt_common& c) {
return c.cell_cfg.cell_id == cell_id;
});
return it == cell_list.end() ? nullptr : &(*it);
}
cell_ctxt_common* cell_ctxt_common_list::get_pci(uint32_t pci)
{
auto it = std::find_if(
cell_list.begin(), cell_list.end(), [pci](const cell_ctxt_common& c) { return c.cell_cfg.pci == pci; });
return it == cell_list.end() ? nullptr : &(*it);
}
} // namespace srsenb

@ -20,6 +20,7 @@
*/ */
#include "srsenb/hdr/stack/rrc/rrc_mobility.h" #include "srsenb/hdr/stack/rrc/rrc_mobility.h"
#include "srsenb/hdr/stack/rrc/rrc_cell_cfg.h"
#include "srslte/asn1/rrc_asn1_utils.h" #include "srslte/asn1/rrc_asn1_utils.h"
#include "srslte/common/bcd_helpers.h" #include "srslte/common/bcd_helpers.h"
#include "srslte/common/common.h" #include "srslte/common/common.h"
@ -710,7 +711,7 @@ bool rrc::ue::rrc_mobility::fill_conn_recfg_msg(asn1::rrc::rrc_conn_recfg_r8_ies
} }
// Check if there has been any update in ue_var_meas // Check if there has been any update in ue_var_meas
cell_ctxt_t* pcell = rrc_ue->get_ue_cc_cfg(UE_PCELL_CC_IDX); cell_ctxt_common* pcell = rrc_ue->get_ue_cc_cfg(UE_PCELL_CC_IDX);
asn1::rrc::meas_cfg_s& meas_cfg = conn_recfg->meas_cfg; asn1::rrc::meas_cfg_s& meas_cfg = conn_recfg->meas_cfg;
conn_recfg->meas_cfg_present = update_ue_var_meas_cfg(*ue_var_meas, pcell->enb_cc_idx, &meas_cfg); conn_recfg->meas_cfg_present = update_ue_var_meas_cfg(*ue_var_meas, pcell->enb_cc_idx, &meas_cfg);
return conn_recfg->meas_cfg_present; return conn_recfg->meas_cfg_present;

Loading…
Cancel
Save