move packing of SCell list into extra method and add fill PHY config on the spot

previously we've packed the RRCReconfig with SCellToAddMod list and have then
parsed the message again to pack the PHY config dedicated for the new SCell carrier. This
is now done in one step.
master
Andre Puschmann 5 years ago
parent d18b476e37
commit b7aad27d86

@ -318,6 +318,9 @@ public:
bool nas_pending = false;
srslte::byte_buffer_t erab_info;
///< Helper to fill SCell struct for RRR Connection Reconfig
void fill_scell_to_addmod_list(asn1::rrc::rrc_conn_recfg_r8_ies_s* conn_reconf);
///< UE's Physical layer dedicated configuration
phy_interface_rrc_lte::phy_rrc_dedicated_list_t phy_rrc_dedicated_list = {};

@ -1832,25 +1832,108 @@ void rrc::ue::send_connection_reconf(srslte::unique_byte_buffer_t pdu)
phy_cfg->pdsch_cfg_ded_present = true;
phy_cfg->pdsch_cfg_ded.p_a = parent->cfg.pdsch_cfg;
// Add SCells. Note: For now the UE supports all carriers
// Add SCells
fill_scell_to_addmod_list(conn_reconf);
apply_reconf_phy_config(*conn_reconf);
current_sched_ue_cfg.dl_ant_info = srslte::make_ant_info_ded(phy_cfg->ant_info.explicit_value());
parent->mac->ue_cfg(rnti, &current_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);
// Get DRB1 configuration
conn_reconf->rr_cfg_ded.drb_to_add_mod_list_present = true;
conn_reconf->rr_cfg_ded.drb_to_add_mod_list.resize(1);
if (get_drbid_config(&conn_reconf->rr_cfg_ded.drb_to_add_mod_list[0], 1)) {
parent->rrc_log->error("Getting DRB1 configuration\n");
parent->rrc_log->console("The QCI %d for DRB1 is invalid or not configured.\n", erabs[5].qos_params.qci);
return;
}
// 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));
parent->pdcp->config_security(rnti, 2, sec_cfg);
parent->pdcp->enable_integrity(rnti, 2);
parent->pdcp->enable_encryption(rnti, 2);
// Configure DRB1 in RLC
parent->rlc->add_bearer(rnti, 3, srslte::make_rlc_config_t(conn_reconf->rr_cfg_ded.drb_to_add_mod_list[0].rlc_cfg));
// Configure DRB1 in PDCP
srslte::pdcp_config_t pdcp_cnfg_drb = srslte::make_drb_pdcp_config_t(1, false);
if (conn_reconf->rr_cfg_ded.drb_to_add_mod_list[0].pdcp_cfg.rlc_um_present) {
if (conn_reconf->rr_cfg_ded.drb_to_add_mod_list[0].pdcp_cfg.rlc_um.pdcp_sn_size.value ==
pdcp_cfg_s::rlc_um_s_::pdcp_sn_size_e_::len7bits) {
pdcp_cnfg_drb.sn_len = srslte::PDCP_SN_LEN_7;
}
}
parent->pdcp->add_bearer(rnti, 3, pdcp_cnfg_drb);
parent->pdcp->config_security(rnti, 3, sec_cfg);
parent->pdcp->enable_integrity(rnti, 3);
parent->pdcp->enable_encryption(rnti, 3);
// DRB1 has already been configured in GTPU through bearer setup
// Add NAS Attach accept
if (nas_pending) {
parent->rrc_log->info_hex(
erab_info.msg, erab_info.N_bytes, "connection_reconf erab_info -> nas_info rnti 0x%x\n", rnti);
conn_reconf->ded_info_nas_list_present = true;
conn_reconf->ded_info_nas_list.resize(1);
conn_reconf->ded_info_nas_list[0].resize(erab_info.N_bytes);
memcpy(conn_reconf->ded_info_nas_list[0].data(), erab_info.msg, erab_info.N_bytes);
} else {
parent->rrc_log->debug("Not adding NAS message to connection reconfiguration\n");
conn_reconf->ded_info_nas_list.resize(0);
}
if (mobility_handler != nullptr) {
mobility_handler->fill_conn_recfg_msg(conn_reconf);
}
last_rrc_conn_recfg = dl_dcch_msg.msg.c1().rrc_conn_recfg();
// Reuse same PDU
pdu->clear();
send_dl_dcch(&dl_dcch_msg, std::move(pdu));
state = RRC_STATE_WAIT_FOR_CON_RECONF_COMPLETE;
}
//! Method to fill SCellToAddModList for SCell info
void rrc::ue::fill_scell_to_addmod_list(asn1::rrc::rrc_conn_recfg_r8_ies_s* conn_reconf)
{
if (parent->cfg.cell_list.size() > 1) {
conn_reconf->non_crit_ext_present = true;
conn_reconf->non_crit_ext.non_crit_ext_present = true;
conn_reconf->non_crit_ext.non_crit_ext.non_crit_ext_present = true;
conn_reconf->non_crit_ext.non_crit_ext.non_crit_ext.scell_to_add_mod_list_r10_present = true;
auto& list = conn_reconf->non_crit_ext.non_crit_ext.non_crit_ext.scell_to_add_mod_list_r10;
list.resize(parent->cfg.cell_list.size() - 1);
uint32_t ue_cc_idx = 1;
for (uint32_t enb_cc_idx = 0; enb_cc_idx < parent->cfg.cell_list.size(); ++enb_cc_idx) {
if (current_sched_ue_cfg.supported_cc_list[0].enb_cc_idx == enb_cc_idx) {
continue;
}
const auto& cell_cfg = parent->cfg.cell_list[enb_cc_idx];
// Add all SCells configured for the current PCell
uint32_t scell_idx = 1; // SCell start with 1, zero reserved for PCell
for (auto& scell : parent->cfg.cell_list.at(current_sched_ue_cfg.supported_cc_list.front().enb_cc_idx).scell_list) {
// get corresponding eNB cell for this scell
const auto& enb_cell =
std::find_if(parent->cfg.cell_list.begin(),
parent->cfg.cell_list.end(),
[scell](const cell_cfg_t& enb_cell_) { return (enb_cell_.cell_id == scell.cell_id); });
if (enb_cell != parent->cfg.cell_list.end()) {
scell_to_add_mod_r10_s cell;
cell.scell_idx_r10 = ue_cc_idx;
cell.scell_idx_r10 = scell_idx;
cell.cell_identif_r10_present = true;
cell.cell_identif_r10.pci_r10 = cell_cfg.pci;
cell.cell_identif_r10.dl_carrier_freq_r10 = cell_cfg.dl_earfcn;
cell.cell_identif_r10.pci_r10 = enb_cell->pci;
cell.cell_identif_r10.dl_carrier_freq_r10 = enb_cell->dl_earfcn;
cell.rr_cfg_common_scell_r10_present = true;
asn1::number_to_enum(cell.rr_cfg_common_scell_r10.non_ul_cfg_r10.dl_bw_r10, parent->cfg.cell.nof_prb);
cell.rr_cfg_common_scell_r10.non_ul_cfg_r10.ant_info_common_r10.ant_ports_count.value =
@ -1926,83 +2009,22 @@ void rrc::ue::send_connection_reconf(srslte::unique_byte_buffer_t pdu)
ul_cfg_ded.srs_ul_cfg_ded_aperiodic_r10_present = true;
ul_cfg_ded.srs_ul_cfg_ded_aperiodic_r10.set(setup_opts::release);
list.push_back(cell);
ue_cc_idx++;
}
}
apply_reconf_phy_config(*conn_reconf);
current_sched_ue_cfg.dl_ant_info = srslte::make_ant_info_ded(phy_cfg->ant_info.explicit_value());
parent->mac->ue_cfg(rnti, &current_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);
// Get DRB1 configuration
conn_reconf->rr_cfg_ded.drb_to_add_mod_list_present = true;
conn_reconf->rr_cfg_ded.drb_to_add_mod_list.resize(1);
if (get_drbid_config(&conn_reconf->rr_cfg_ded.drb_to_add_mod_list[0], 1)) {
parent->rrc_log->error("Getting DRB1 configuration\n");
parent->rrc_log->console("The QCI %d for DRB1 is invalid or not configured.\n", erabs[5].qos_params.qci);
return;
}
// Configure SRB2 in RLC and PDCP
parent->rlc->add_bearer(rnti, 2, srslte::rlc_config_t::srb_config(2));
// Create new PHY configuration structure for this SCell
phy_interface_rrc_lte::phy_rrc_dedicated_t scell_phy_rrc_ded = {};
srslte::set_phy_cfg_t_scell_config(&scell_phy_rrc_ded.phy_cfg, cell);
scell_phy_rrc_ded.configured = true;
// Configure SRB2 in PDCP
parent->pdcp->add_bearer(rnti, 2, srslte::make_srb_pdcp_config_t(2, false));
parent->pdcp->config_security(rnti, 2, sec_cfg);
parent->pdcp->enable_integrity(rnti, 2);
parent->pdcp->enable_encryption(rnti, 2);
// Get corresponding eNB CC index
scell_phy_rrc_ded.enb_cc_idx = std::distance(parent->cfg.cell_list.begin(), enb_cell);
// Configure DRB1 in RLC
parent->rlc->add_bearer(rnti, 3, srslte::make_rlc_config_t(conn_reconf->rr_cfg_ded.drb_to_add_mod_list[0].rlc_cfg));
// Append to PHY RRC config dedicated which will be applied further down
phy_rrc_dedicated_list.push_back(scell_phy_rrc_ded);
// Configure DRB1 in PDCP
srslte::pdcp_config_t pdcp_cnfg_drb = srslte::make_drb_pdcp_config_t(1, false);
if (conn_reconf->rr_cfg_ded.drb_to_add_mod_list[0].pdcp_cfg.rlc_um_present) {
if (conn_reconf->rr_cfg_ded.drb_to_add_mod_list[0].pdcp_cfg.rlc_um.pdcp_sn_size.value ==
pdcp_cfg_s::rlc_um_s_::pdcp_sn_size_e_::len7bits) {
pdcp_cnfg_drb.sn_len = srslte::PDCP_SN_LEN_7;
}
scell_idx++;
}
parent->pdcp->add_bearer(rnti, 3, pdcp_cnfg_drb);
parent->pdcp->config_security(rnti, 3, sec_cfg);
parent->pdcp->enable_integrity(rnti, 3);
parent->pdcp->enable_encryption(rnti, 3);
// DRB1 has already been configured in GTPU through bearer setup
// Add NAS Attach accept
if (nas_pending) {
parent->rrc_log->info_hex(
erab_info.msg, erab_info.N_bytes, "connection_reconf erab_info -> nas_info rnti 0x%x\n", rnti);
conn_reconf->ded_info_nas_list_present = true;
conn_reconf->ded_info_nas_list.resize(1);
conn_reconf->ded_info_nas_list[0].resize(erab_info.N_bytes);
memcpy(conn_reconf->ded_info_nas_list[0].data(), erab_info.msg, erab_info.N_bytes);
} else {
parent->rrc_log->debug("Not adding NAS message to connection reconfiguration\n");
conn_reconf->ded_info_nas_list.resize(0);
}
if (mobility_handler != nullptr) {
mobility_handler->fill_conn_recfg_msg(conn_reconf);
}
last_rrc_conn_recfg = dl_dcch_msg.msg.c1().rrc_conn_recfg();
// Reuse same PDU
pdu->clear();
send_dl_dcch(&dl_dcch_msg, std::move(pdu));
state = RRC_STATE_WAIT_FOR_CON_RECONF_COMPLETE;
}
void rrc::ue::send_connection_reconf_new_bearer(const asn1::s1ap::erab_to_be_setup_list_bearer_su_req_l& e)
@ -2347,50 +2369,7 @@ void rrc::ue::apply_reconf_phy_config(const asn1::rrc::rrc_conn_recfg_r8_ies_s&
// Handle Add/Modify SCell list
if (reconfig_r1020.scell_to_add_mod_list_r10_present) {
for (const auto& scell_config : reconfig_r1020.scell_to_add_mod_list_r10) {
// UE SCell index
uint32_t scell_idx = scell_config.scell_idx_r10;
// Check that the SCell index is correct.
if (scell_idx == 0) {
// SCell index is reserved for PCell
parent->rrc_log->error("SCell index (%d) is reserved for PCell\n", scell_idx);
} else if (scell_idx < current_sched_ue_cfg.supported_cc_list.size()) {
// Get PHY configuration structure, create entry automatically
auto& phy_rrc_dedicated = phy_rrc_dedicated_list[scell_idx];
// Set eNb Cell/Carrier index
phy_rrc_dedicated.configured = true;
phy_rrc_dedicated.enb_cc_idx = current_sched_ue_cfg.supported_cc_list[scell_idx].enb_cc_idx;
// Set SCell configuration
srslte::set_phy_cfg_t_scell_config(&phy_rrc_dedicated.phy_cfg, scell_config);
} else {
// Out of bounds, log error
parent->rrc_log->error("SCell index (%d) points out of the supported list (%ld)\n",
scell_idx,
current_sched_ue_cfg.supported_cc_list.size());
}
}
}
// Handle Remove SCell list
if (reconfig_r1020.scell_to_release_list_r10_present) {
for (auto& scell_to_release : reconfig_r1020.scell_to_release_list_r10) {
if (scell_to_release == 0) {
// SCell index is reserved for PCell
parent->rrc_log->error("SCell index (%d) is reserved for PCell\n", scell_to_release);
} else if (scell_to_release < current_sched_ue_cfg.supported_cc_list.size()) {
// Deactivate cell configuration
phy_rrc_dedicated_list[scell_to_release].configured = false;
} else {
// Out of bounds, log error
parent->rrc_log->error("SCell index (%d) points out of the supported list (%ld)\n",
scell_to_release,
current_sched_ue_cfg.supported_cc_list.size());
}
}
// This is already applied when packing the SCell list
}
}
}

Loading…
Cancel
Save