|
|
|
@ -37,10 +37,7 @@ using namespace asn1::rrc;
|
|
|
|
|
|
|
|
|
|
namespace srsenb {
|
|
|
|
|
|
|
|
|
|
rrc::rrc() : rrc_log("RRC")
|
|
|
|
|
{
|
|
|
|
|
pending_paging.clear();
|
|
|
|
|
}
|
|
|
|
|
rrc::rrc() : rrc_log("RRC") { pending_paging.clear(); }
|
|
|
|
|
|
|
|
|
|
rrc::~rrc() {}
|
|
|
|
|
|
|
|
|
@ -140,10 +137,7 @@ void rrc::rem_user_thread(uint16_t rnti)
|
|
|
|
|
rx_pdu_queue.push(std::move(p));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint32_t rrc::get_nof_users()
|
|
|
|
|
{
|
|
|
|
|
return users.size();
|
|
|
|
|
}
|
|
|
|
|
uint32_t rrc::get_nof_users() { return users.size(); }
|
|
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
|
void rrc::log_rrc_message(const std::string& source,
|
|
|
|
@ -910,15 +904,9 @@ void rrc::configure_security(uint16_t rnti, uint32_t lcid, srslte::as_security_c
|
|
|
|
|
pdcp->config_security(rnti, lcid, sec_cfg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void rrc::enable_integrity(uint16_t rnti, uint32_t lcid)
|
|
|
|
|
{
|
|
|
|
|
pdcp->enable_integrity(rnti, lcid);
|
|
|
|
|
}
|
|
|
|
|
void rrc::enable_integrity(uint16_t rnti, uint32_t lcid) { pdcp->enable_integrity(rnti, lcid); }
|
|
|
|
|
|
|
|
|
|
void rrc::enable_encryption(uint16_t rnti, uint32_t lcid)
|
|
|
|
|
{
|
|
|
|
|
pdcp->enable_encryption(rnti, lcid);
|
|
|
|
|
}
|
|
|
|
|
void rrc::enable_encryption(uint16_t rnti, uint32_t lcid) { pdcp->enable_encryption(rnti, lcid); }
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
|
RRC run tti method
|
|
|
|
@ -985,7 +973,8 @@ rrc::ue::ue(rrc* outer_rrc, uint16_t rnti_, const sched_interface::ue_cfg_t& sch
|
|
|
|
|
pool(srslte::byte_buffer_pool::get_instance()),
|
|
|
|
|
current_sched_ue_cfg(sched_ue_cfg),
|
|
|
|
|
phy_rrc_dedicated_list(sched_ue_cfg.supported_cc_list.size()),
|
|
|
|
|
cell_ded_list(parent->cfg, *outer_rrc->pucch_res_list, *outer_rrc->cell_common_list)
|
|
|
|
|
cell_ded_list(parent->cfg, *outer_rrc->pucch_res_list, *outer_rrc->cell_common_list),
|
|
|
|
|
bearer_list(rnti_, parent->cfg, parent->pdcp, parent->rlc, parent->gtpu)
|
|
|
|
|
{
|
|
|
|
|
if (current_sched_ue_cfg.supported_cc_list.empty() or not current_sched_ue_cfg.supported_cc_list[0].active) {
|
|
|
|
|
parent->rrc_log->warning("No PCell set. Picking eNBccIdx=0 as PCell\n");
|
|
|
|
@ -1009,10 +998,7 @@ rrc::ue::ue(rrc* outer_rrc, uint16_t rnti_, const sched_interface::ue_cfg_t& sch
|
|
|
|
|
|
|
|
|
|
rrc::ue::~ue() {}
|
|
|
|
|
|
|
|
|
|
rrc_state_t rrc::ue::get_state()
|
|
|
|
|
{
|
|
|
|
|
return state;
|
|
|
|
|
}
|
|
|
|
|
rrc_state_t rrc::ue::get_state() { return state; }
|
|
|
|
|
|
|
|
|
|
uint32_t rrc::ue::rl_failure()
|
|
|
|
|
{
|
|
|
|
@ -1081,15 +1067,9 @@ void rrc::ue::set_activity_timeout(const activity_timeout_type_t type)
|
|
|
|
|
set_activity();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool rrc::ue::is_connected()
|
|
|
|
|
{
|
|
|
|
|
return state == RRC_STATE_REGISTERED;
|
|
|
|
|
}
|
|
|
|
|
bool rrc::ue::is_connected() { return state == RRC_STATE_REGISTERED; }
|
|
|
|
|
|
|
|
|
|
bool rrc::ue::is_idle()
|
|
|
|
|
{
|
|
|
|
|
return state == RRC_STATE_IDLE;
|
|
|
|
|
}
|
|
|
|
|
bool rrc::ue::is_idle() { return state == RRC_STATE_IDLE; }
|
|
|
|
|
|
|
|
|
|
void rrc::ue::parse_ul_dcch(uint32_t lcid, srslte::unique_byte_buffer_t pdu)
|
|
|
|
|
{
|
|
|
|
@ -1315,15 +1295,9 @@ bool rrc::ue::handle_ue_cap_info(ue_cap_info_s* msg)
|
|
|
|
|
// parent->s1ap->ue_capabilities(rnti, &eutra_capabilities);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void rrc::ue::set_bitrates(const asn1::s1ap::ue_aggregate_maximum_bitrate_s& rates)
|
|
|
|
|
{
|
|
|
|
|
bitrates = rates;
|
|
|
|
|
}
|
|
|
|
|
void rrc::ue::set_bitrates(const asn1::s1ap::ue_aggregate_maximum_bitrate_s& rates) { bitrates = rates; }
|
|
|
|
|
|
|
|
|
|
void rrc::ue::set_security_capabilities(const asn1::s1ap::ue_security_cap_s& caps)
|
|
|
|
|
{
|
|
|
|
|
security_capabilities = caps;
|
|
|
|
|
}
|
|
|
|
|
void rrc::ue::set_security_capabilities(const asn1::s1ap::ue_security_cap_s& caps) { security_capabilities = caps; }
|
|
|
|
|
|
|
|
|
|
void rrc::ue::set_security_key(const asn1::fixed_bitstring<256, false, true>& key)
|
|
|
|
|
{
|
|
|
|
@ -1492,6 +1466,9 @@ void rrc::ue::send_connection_reject()
|
|
|
|
|
|
|
|
|
|
void rrc::ue::send_connection_setup(bool is_setup)
|
|
|
|
|
{
|
|
|
|
|
// (Re-)Establish SRB1
|
|
|
|
|
bearer_list.setup_srb(1);
|
|
|
|
|
|
|
|
|
|
dl_ccch_msg_s dl_ccch_msg;
|
|
|
|
|
dl_ccch_msg.msg.set_c1();
|
|
|
|
|
|
|
|
|
@ -1508,15 +1485,6 @@ void rrc::ue::send_connection_setup(bool is_setup)
|
|
|
|
|
rr_cfg = &dl_ccch_msg.msg.c1().rrc_conn_reest().crit_exts.c1().rrc_conn_reest_r8().rr_cfg_ded;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add SRB1 to cfg
|
|
|
|
|
rr_cfg->srb_to_add_mod_list_present = true;
|
|
|
|
|
rr_cfg->srb_to_add_mod_list.resize(1);
|
|
|
|
|
rr_cfg->srb_to_add_mod_list[0].srb_id = 1;
|
|
|
|
|
rr_cfg->srb_to_add_mod_list[0].lc_ch_cfg_present = true;
|
|
|
|
|
rr_cfg->srb_to_add_mod_list[0].lc_ch_cfg.set(srb_to_add_mod_s::lc_ch_cfg_c_::types::default_value);
|
|
|
|
|
rr_cfg->srb_to_add_mod_list[0].rlc_cfg_present = true;
|
|
|
|
|
rr_cfg->srb_to_add_mod_list[0].rlc_cfg.set(srb_to_add_mod_s::rlc_cfg_c_::types::default_value);
|
|
|
|
|
|
|
|
|
|
// mac-MainConfig
|
|
|
|
|
rr_cfg->mac_main_cfg_present = true;
|
|
|
|
|
mac_main_cfg_s* mac_cfg = &rr_cfg->mac_main_cfg.set_explicit_value();
|
|
|
|
@ -1611,26 +1579,22 @@ void rrc::ue::send_connection_setup(bool is_setup)
|
|
|
|
|
current_sched_ue_cfg.pucch_cfg.N_pucch_1 = sib2.rr_cfg_common.pucch_cfg_common.n1_pucch_an;
|
|
|
|
|
current_sched_ue_cfg.dl_ant_info = srslte::make_ant_info_ded(phy_cfg->ant_info.explicit_value());
|
|
|
|
|
|
|
|
|
|
// Configure MAC
|
|
|
|
|
// Configure MAC + RLC + PDCP
|
|
|
|
|
if (is_setup) {
|
|
|
|
|
// In case of RRC Connection Setup message (Msg4), we need to resolve the contention by sending a ConRes CE
|
|
|
|
|
parent->mac->ue_set_crnti(rnti, rnti, ¤t_sched_ue_cfg);
|
|
|
|
|
|
|
|
|
|
bearer_list.handle_rrc_setup(&dl_ccch_msg.msg.c1().rrc_conn_setup().crit_exts.c1().rrc_conn_setup_r8());
|
|
|
|
|
} else {
|
|
|
|
|
parent->mac->ue_cfg(rnti, ¤t_sched_ue_cfg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Configure SRB1 in RLC
|
|
|
|
|
parent->rlc->add_bearer(rnti, 1, srslte::rlc_config_t::srb_config(1));
|
|
|
|
|
|
|
|
|
|
// Configure SRB1 in PDCP
|
|
|
|
|
parent->pdcp->add_bearer(rnti, 1, srslte::make_srb_pdcp_config_t(1, false));
|
|
|
|
|
bearer_list.handle_rrc_reest(&dl_ccch_msg.msg.c1().rrc_conn_reest().crit_exts.c1().rrc_conn_reest_r8());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Configure PHY layer
|
|
|
|
|
apply_setup_phy_config_dedicated(*phy_cfg); // It assumes SCell has not been set before
|
|
|
|
|
parent->mac->phy_config_enabled(rnti, false);
|
|
|
|
|
|
|
|
|
|
rr_cfg->drb_to_add_mod_list_present = false;
|
|
|
|
|
rr_cfg->drb_to_release_list_present = false;
|
|
|
|
|
rr_cfg->rlf_timers_and_consts_r9.set_present(false);
|
|
|
|
|
rr_cfg->sps_cfg_present = false;
|
|
|
|
|
// rr_cfg->rlf_timers_and_constants_present = false;
|
|
|
|
@ -1638,10 +1602,7 @@ void rrc::ue::send_connection_setup(bool is_setup)
|
|
|
|
|
send_dl_ccch(&dl_ccch_msg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void rrc::ue::send_connection_reest()
|
|
|
|
|
{
|
|
|
|
|
send_connection_setup(false);
|
|
|
|
|
}
|
|
|
|
|
void rrc::ue::send_connection_reest() { send_connection_setup(false); }
|
|
|
|
|
|
|
|
|
|
void rrc::ue::send_connection_release()
|
|
|
|
|
{
|
|
|
|
@ -1752,6 +1713,9 @@ void rrc::ue::send_connection_reconf_upd(srslte::unique_byte_buffer_t pdu)
|
|
|
|
|
|
|
|
|
|
void rrc::ue::send_connection_reconf(srslte::unique_byte_buffer_t pdu)
|
|
|
|
|
{
|
|
|
|
|
// Setup SRB2
|
|
|
|
|
bearer_list.setup_srb(2);
|
|
|
|
|
|
|
|
|
|
dl_dcch_msg_s dl_dcch_msg;
|
|
|
|
|
dl_dcch_msg.msg.set_c1().set_rrc_conn_recfg().crit_exts.set_c1().set_rrc_conn_recfg_r8();
|
|
|
|
|
dl_dcch_msg.msg.c1().rrc_conn_recfg().rrc_transaction_id = (uint8_t)((transaction_id++) % 4);
|
|
|
|
@ -1821,20 +1785,10 @@ void rrc::ue::send_connection_reconf(srslte::unique_byte_buffer_t pdu)
|
|
|
|
|
parent->mac->ue_cfg(rnti, ¤t_sched_ue_cfg);
|
|
|
|
|
parent->mac->phy_config_enabled(rnti, false);
|
|
|
|
|
|
|
|
|
|
// Add SRB2 to the message
|
|
|
|
|
conn_reconf->rr_cfg_ded.srb_to_add_mod_list_present = true;
|
|
|
|
|
conn_reconf->rr_cfg_ded.srb_to_add_mod_list.resize(1);
|
|
|
|
|
conn_reconf->rr_cfg_ded.srb_to_add_mod_list[0].srb_id = 2;
|
|
|
|
|
conn_reconf->rr_cfg_ded.srb_to_add_mod_list[0].lc_ch_cfg_present = true;
|
|
|
|
|
conn_reconf->rr_cfg_ded.srb_to_add_mod_list[0].lc_ch_cfg.set(srb_to_add_mod_s::lc_ch_cfg_c_::types::default_value);
|
|
|
|
|
conn_reconf->rr_cfg_ded.srb_to_add_mod_list[0].rlc_cfg_present = true;
|
|
|
|
|
conn_reconf->rr_cfg_ded.srb_to_add_mod_list[0].rlc_cfg.set(srb_to_add_mod_s::rlc_cfg_c_::types::default_value);
|
|
|
|
|
// Fill Reconf message, and setup SRB2/DRBs in PDCP and RLC
|
|
|
|
|
bearer_list.handle_rrc_reconf(conn_reconf);
|
|
|
|
|
|
|
|
|
|
// Configure SRB2 in RLC and PDCP
|
|
|
|
|
parent->rlc->add_bearer(rnti, 2, srslte::rlc_config_t::srb_config(2));
|
|
|
|
|
|
|
|
|
|
// Configure SRB2 in PDCP
|
|
|
|
|
parent->pdcp->add_bearer(rnti, 2, srslte::make_srb_pdcp_config_t(2, false));
|
|
|
|
|
// Configure SRB2 security
|
|
|
|
|
parent->pdcp->config_security(rnti, 2, sec_cfg);
|
|
|
|
|
parent->pdcp->enable_integrity(rnti, 2);
|
|
|
|
|
parent->pdcp->enable_encryption(rnti, 2);
|
|
|
|
@ -2444,10 +2398,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();
|
|
|
|
|
}
|
|
|
|
|
bool rrc::ue::is_allocated() const { return cell_ded_list.is_allocated(); }
|
|
|
|
|
|
|
|
|
|
int rrc::ue::get_ri(uint32_t m_ri, uint16_t* ri_idx)
|
|
|
|
|
{
|
|
|
|
|