Add decoding of RRC reconfiguration.

This commit is contained in:
Fabian Eckermann 2021-12-13 16:18:18 +01:00 committed by Andre Puschmann
parent a9724fced1
commit a6c1098afe
3 changed files with 74 additions and 11 deletions

View File

@ -142,6 +142,7 @@ private:
// helpers
void handle_sib1(const asn1::rrc_nr::sib1_s& sib1);
bool handle_rrc_setup(const asn1::rrc_nr::rrc_setup_s& setup);
void handle_rrc_reconfig(const asn1::rrc_nr::rrc_recfg_s& reconfig);
srsran::task_sched_handle task_sched;
struct cmd_msg_t {

View File

@ -280,6 +280,20 @@ void rrc_nr::decode_dl_dcch(uint32_t lcid, unique_byte_buffer_t pdu)
return;
}
log_rrc_message(get_rb_name(lcid), Rx, pdu.get(), dl_dcch_msg, dl_dcch_msg.msg.c1().type().to_string());
dl_dcch_msg_type_c::c1_c_* c1 = &dl_dcch_msg.msg.c1();
switch (dl_dcch_msg.msg.c1().type().value) {
// TODO: ADD missing cases
case dl_dcch_msg_type_c::c1_c_::types::rrc_recfg: {
transaction_id = c1->rrc_recfg().rrc_transaction_id;
rrc_recfg_s recfg = c1->rrc_recfg();
task_sched.defer_task([this, recfg]() { handle_rrc_reconfig(recfg); });
break;
}
default:
logger.error("The provided DL-CCCH message type is not recognized or supported");
break;
}
}
void rrc_nr::write_pdu_bcch_bch(srsran::unique_byte_buffer_t pdu) {}
@ -815,8 +829,8 @@ int rrc_nr::get_nr_capabilities(srsran::byte_buffer_t* nr_caps_pdu)
void rrc_nr::phy_meas_stop()
{
// possbile race condition for sim_measurement timer, which might be set at the same moment as stopped => fix with
// phy integration
// possbile race condition for sim_measurement timer, which might be set at the same moment as stopped => fix
// with phy integration
logger.debug("Stopping simulated measurements");
sim_measurement_timer.stop();
}
@ -1936,6 +1950,15 @@ bool rrc_nr::handle_rrc_setup(const rrc_setup_s& setup)
return true;
}
void rrc_nr::handle_rrc_reconfig(const rrc_recfg_s& reconfig)
{
if (not conn_recfg_proc.launch(nr, false, reconfig)) {
logger.error("Unable to launch connection reconfiguration procedure");
return;
}
callback_list.add_proc(conn_recfg_proc);
}
// RLC interface
void rrc_nr::max_retx_attempted() {}
void rrc_nr::protocol_failure() {}

View File

@ -42,41 +42,80 @@ proc_outcome_t rrc_nr::connection_reconf_no_ho_proc::init(const reconf_initiator
if (rrc_nr_reconf.crit_exts.rrc_recfg().secondary_cell_group_present) {
if (rrc_nr_reconf.crit_exts.type() != asn1::rrc_nr::rrc_recfg_s::crit_exts_c_::types::rrc_recfg) {
Error("Reconfiguration does not contain Secondary Cell Group Config");
Error("Reconfiguration does not contain Secondary Cell Group Config.");
return proc_outcome_t::error;
}
cbit_ref bref0(rrc_nr_reconf.crit_exts.rrc_recfg().secondary_cell_group.data(),
rrc_nr_reconf.crit_exts.rrc_recfg().secondary_cell_group.size());
cell_group_cfg_s cell_group_cfg;
if (cell_group_cfg.unpack(bref0) != asn1::SRSASN_SUCCESS) {
Error("Could not unpack secondary cell group config.");
cell_group_cfg_s secondary_cell_group_cfg;
if (secondary_cell_group_cfg.unpack(bref0) != asn1::SRSASN_SUCCESS) {
Error("Could not unpack Secondary Cell Group Config.");
return proc_outcome_t::error;
}
#if 0
asn1::json_writer js1;
cell_group_cfg.to_json(js1);
secondary_cell_group_cfg.to_json(js1);
Debug("Secondary Cell Group: %s", js1.to_string().c_str());
#endif
Info("Applying Cell Group Cfg");
if (!rrc_handle.apply_cell_group_cfg(cell_group_cfg)) {
Info("Applying Secondary Cell Group Cfg.");
if (!rrc_handle.apply_cell_group_cfg(secondary_cell_group_cfg)) {
return proc_outcome_t::error;
}
}
if (rrc_nr_reconf.crit_exts.rrc_recfg().non_crit_ext.non_crit_ext.non_crit_ext.sk_counter_present) {
Info("Applying sk counter");
Info("Applying SK Counter");
if (!rrc_handle.configure_sk_counter(
(uint16_t)rrc_nr_reconf.crit_exts.rrc_recfg().non_crit_ext.non_crit_ext.non_crit_ext.sk_counter)) {
return proc_outcome_t::error;
}
}
if (rrc_nr_reconf.crit_exts.rrc_recfg().non_crit_ext.master_cell_group_present) {
cbit_ref bref1(rrc_nr_reconf.crit_exts.rrc_recfg().non_crit_ext.master_cell_group.data(),
rrc_nr_reconf.crit_exts.rrc_recfg().non_crit_ext.master_cell_group.size());
cell_group_cfg_s master_cell_group_cfg;
if (master_cell_group_cfg.unpack(bref1) != asn1::SRSASN_SUCCESS) {
Error("Could not unpack Master Cell Group Config.");
return proc_outcome_t::error;
}
#if 0
asn1::json_writer js2;
master_cell_group_cfg.to_json(js2);
Debug("Master Cell Group: %s", js2.to_string().c_str());
#endif
Info("Applying Master Cell Group Cfg.");
if (!rrc_handle.apply_cell_group_cfg(master_cell_group_cfg)) {
return proc_outcome_t::error;
}
}
if (rrc_nr_reconf.crit_exts.rrc_recfg().non_crit_ext.ded_nas_msg_list_present) {
srsran::unique_byte_buffer_t nas_sdu;
for (uint32_t i = 0; i < rrc_nr_reconf.crit_exts.rrc_recfg().non_crit_ext.ded_nas_msg_list.size(); ++i) {
nas_sdu = srsran::make_byte_buffer();
if (nas_sdu != nullptr) {
memcpy(nas_sdu->msg,
rrc_nr_reconf.crit_exts.rrc_recfg().non_crit_ext.ded_nas_msg_list[i].data(),
rrc_nr_reconf.crit_exts.rrc_recfg().non_crit_ext.ded_nas_msg_list[i].size());
nas_sdu->N_bytes = rrc_nr_reconf.crit_exts.rrc_recfg().non_crit_ext.ded_nas_msg_list[i].size();
rrc_handle.write_sdu(std::move(nas_sdu));
} else {
rrc_handle.logger.error("Couldn't allocate SDU in %s.", __FUNCTION__);
return proc_outcome_t::error;
}
}
}
if (rrc_nr_reconf.crit_exts.rrc_recfg().radio_bearer_cfg_present) {
Info("Applying Radio Bearer Cfg");
Info("Applying Radio Bearer Cfg.");
if (!rrc_handle.apply_radio_bearer_cfg(rrc_nr_reconf.crit_exts.rrc_recfg().radio_bearer_cfg)) {
return proc_outcome_t::error;
}