gnb,rrc: add error checking/handling when creating cellgroup cfg

master
Andre Puschmann 3 years ago
parent d3a049bd7b
commit bbd84f087e

@ -44,11 +44,11 @@ bool compute_diff_radio_bearer_cfg(const rrc_nr_cfg_t& cfg,
asn1::rrc_nr::radio_bearer_cfg_s& diff);
/// Apply radioBearerConfig updates to CellGroupConfig
void fill_cellgroup_with_radio_bearer_cfg(const rrc_nr_cfg_t& cfg,
uint32_t rnti,
const enb_bearer_manager& bearer_mapper,
const asn1::rrc_nr::radio_bearer_cfg_s& bearers,
asn1::rrc_nr::cell_group_cfg_s& out);
int fill_cellgroup_with_radio_bearer_cfg(const rrc_nr_cfg_t& cfg,
uint32_t rnti,
const enb_bearer_manager& bearer_mapper,
const asn1::rrc_nr::radio_bearer_cfg_s& bearers,
asn1::rrc_nr::cell_group_cfg_s& out);
} // namespace srsenb

@ -1331,11 +1331,11 @@ bool compute_diff_radio_bearer_cfg(const rrc_nr_cfg_t& cfg,
diff.drb_to_add_mod_list.size() > 0;
}
void fill_cellgroup_with_radio_bearer_cfg(const rrc_nr_cfg_t& cfg,
const uint32_t rnti,
const enb_bearer_manager& bearer_mapper,
const asn1::rrc_nr::radio_bearer_cfg_s& bearers,
asn1::rrc_nr::cell_group_cfg_s& out)
int fill_cellgroup_with_radio_bearer_cfg(const rrc_nr_cfg_t& cfg,
const uint32_t rnti,
const enb_bearer_manager& bearer_mapper,
const asn1::rrc_nr::radio_bearer_cfg_s& bearers,
asn1::rrc_nr::cell_group_cfg_s& out)
{
out.rlc_bearer_to_add_mod_list.clear();
out.rlc_bearer_to_release_list.clear();
@ -1350,13 +1350,19 @@ void fill_cellgroup_with_radio_bearer_cfg(const rrc_nr_cfg_t&
out.rlc_bearer_to_add_mod_list.push_back({});
uint32_t lcid = drb.drb_id + (int)srsran::nr_srb::count - 1;
enb_bearer_manager::radio_bearer_t rb = bearer_mapper.get_lcid_bearer(rnti, lcid);
fill_drb(cfg, rb, (srsran::nr_drb)drb.drb_id, out.rlc_bearer_to_add_mod_list.back());
if (rb.is_valid() and cfg.five_qi_cfg.find(rb.five_qi) != cfg.five_qi_cfg.end()) {
fill_drb(cfg, rb, (srsran::nr_drb)drb.drb_id, out.rlc_bearer_to_add_mod_list.back());
} else {
return SRSRAN_ERROR;
}
}
// Release DRBs
for (uint8_t drb_id : bearers.drb_to_release_list) {
out.rlc_bearer_to_release_list.push_back(drb_id);
}
return SRSRAN_SUCCESS;
}
} // namespace srsenb

@ -900,8 +900,13 @@ void rrc_nr::ue::handle_rrc_reestablishment_request(const asn1::rrc_nr::rrc_rees
// compute config and create SRB1 for new user
asn1::rrc_nr::radio_bearer_cfg_s dummy_radio_bearer_cfg; // just to compute difference, it's never sent to UE
compute_diff_radio_bearer_cfg(parent->cfg, radio_bearer_cfg, next_radio_bearer_cfg, dummy_radio_bearer_cfg);
fill_cellgroup_with_radio_bearer_cfg(
parent->cfg, old_rnti, *parent->bearer_mapper, dummy_radio_bearer_cfg, next_cell_group_cfg);
if (fill_cellgroup_with_radio_bearer_cfg(
parent->cfg, old_rnti, *parent->bearer_mapper, dummy_radio_bearer_cfg, next_cell_group_cfg) !=
SRSRAN_SUCCESS) {
logger.error("Couldn't fill cellGroupCfg during RRC Reestablishment");
send_rrc_reject(max_wait_time_secs);
return;
}
// send RRC Reestablishment message and restore bearer configuration
send_connection_reest(old_ue->sec_ctx.get_ncc());
@ -996,8 +1001,14 @@ void rrc_nr::ue::send_rrc_setup()
// - Setup masterCellGroup
// - Derive master cell group config bearers
fill_cellgroup_with_radio_bearer_cfg(
parent->cfg, rnti, *parent->bearer_mapper, setup_ies.radio_bearer_cfg, next_cell_group_cfg);
if (fill_cellgroup_with_radio_bearer_cfg(
parent->cfg, rnti, *parent->bearer_mapper, setup_ies.radio_bearer_cfg, next_cell_group_cfg) !=
SRSRAN_SUCCESS) {
logger.error("Couldn't fill cellGroupCfg during RRC Setup");
send_rrc_reject(max_wait_time_secs);
return;
}
// - Pack masterCellGroup into container
srsran::unique_byte_buffer_t pdu = parent->pack_into_pdu(next_cell_group_cfg, __FUNCTION__);
if (pdu == nullptr) {
@ -1141,8 +1152,12 @@ void rrc_nr::ue::send_rrc_reconfiguration()
// Fill masterCellGroup
cell_group_cfg_s master_cell_group;
master_cell_group.cell_group_id = 0;
fill_cellgroup_with_radio_bearer_cfg(
parent->cfg, rnti, *parent->bearer_mapper, ies.radio_bearer_cfg, master_cell_group);
if (fill_cellgroup_with_radio_bearer_cfg(
parent->cfg, rnti, *parent->bearer_mapper, ies.radio_bearer_cfg, master_cell_group) != SRSRAN_SUCCESS) {
logger.error("Couldn't fill cellGroupCfg during RRC Reconfiguration");
parent->ngap->user_release_request(rnti, asn1::ngap::cause_radio_network_opts::radio_res_not_available);
return;
}
// Pack masterCellGroup into container
srsran::unique_byte_buffer_t pdu = parent->pack_into_pdu(master_cell_group, __FUNCTION__);
@ -1307,6 +1322,11 @@ void rrc_nr::ue::establish_eps_bearer(uint32_t pdu_session_id,
uint32_t lcid,
uint32_t five_qi)
{
if (parent->cfg.five_qi_cfg.find(five_qi) == parent->cfg.five_qi_cfg.end()) {
parent->logger.error("No bearer config for 5QI %d present. Aborting DRB addition.", five_qi);
return;
}
// Enqueue NAS PDU
srsran::unique_byte_buffer_t pdu = srsran::make_byte_buffer();
if (pdu == nullptr) {

Loading…
Cancel
Save