From bbae0ce93cbc07b04e57599270dc51f3d461fa38 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Thu, 3 Mar 2022 18:51:05 +0000 Subject: [PATCH] gnb,rrc_nr: Filling in RLC-NR DRB configs from 5QI config now. --- srsgnb/hdr/stack/rrc/cell_asn1_config.h | 3 +++ srsgnb/src/stack/rrc/cell_asn1_config.cc | 24 ++++++++++++------------ srsgnb/src/stack/rrc/rrc_nr_ue.cc | 9 ++++++--- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/srsgnb/hdr/stack/rrc/cell_asn1_config.h b/srsgnb/hdr/stack/rrc/cell_asn1_config.h index 3ad12601c..2898acd20 100644 --- a/srsgnb/hdr/stack/rrc/cell_asn1_config.h +++ b/srsgnb/hdr/stack/rrc/cell_asn1_config.h @@ -15,6 +15,7 @@ #include "rrc_nr_config.h" #include "srsran/asn1/rrc_nr.h" +#include "srsran/common/bearer_manager.h" #include "srsran/common/common_nr.h" namespace srsenb { @@ -44,6 +45,8 @@ bool compute_diff_radio_bearer_cfg(const rrc_nr_cfg_t& cfg, /// 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); diff --git a/srsgnb/src/stack/rrc/cell_asn1_config.cc b/srsgnb/src/stack/rrc/cell_asn1_config.cc index 9da82a9a1..7e2a37e00 100644 --- a/srsgnb/src/stack/rrc/cell_asn1_config.cc +++ b/srsgnb/src/stack/rrc/cell_asn1_config.cc @@ -978,20 +978,17 @@ void fill_srb(const rrc_nr_cfg_t& cfg, srsran::nr_srb srb_id, asn1::rrc_nr::rlc_ } /// Fill DRB with parameters derived from cfg -void fill_drb(const rrc_nr_cfg_t& cfg, uint32_t lcid, srsran::nr_drb drb_id, asn1::rrc_nr::rlc_bearer_cfg_s& out) +void fill_drb(const rrc_nr_cfg_t& cfg, + const enb_bearer_manager::radio_bearer_t& rb, + srsran::nr_drb drb_id, + asn1::rrc_nr::rlc_bearer_cfg_s& out) { - out.lc_ch_id = lcid; + out.lc_ch_id = rb.lcid; out.served_radio_bearer_present = true; out.served_radio_bearer.set_drb_id() = (uint8_t)drb_id; - out.rlc_cfg_present = true; - auto& ul_um = out.rlc_cfg.set_um_bi_dir().ul_um_rlc; - ul_um.sn_field_len_present = true; - ul_um.sn_field_len.value = sn_field_len_um_opts::size12; - auto& dl_um = out.rlc_cfg.um_bi_dir().dl_um_rlc; - dl_um.sn_field_len_present = true; - dl_um.sn_field_len.value = sn_field_len_um_opts::size12; - dl_um.t_reassembly.value = t_reassembly_opts::ms50; + out.rlc_cfg_present = true; + out.rlc_cfg = cfg.five_qi_cfg.at(rb.five_qi).rlc_cfg; // MAC logical channel config out.mac_lc_ch_cfg_present = true; @@ -1319,6 +1316,8 @@ bool compute_diff_radio_bearer_cfg(const rrc_nr_cfg_t& cfg, } 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) { @@ -1333,8 +1332,9 @@ void fill_cellgroup_with_radio_bearer_cfg(const rrc_nr_cfg_t& // Add DRBs for (const drb_to_add_mod_s& drb : bearers.drb_to_add_mod_list) { out.rlc_bearer_to_add_mod_list.push_back({}); - uint32_t lcid = drb.drb_id + (int)srsran::nr_srb::count - 1; - fill_drb(cfg, lcid, (srsran::nr_drb)drb.drb_id, out.rlc_bearer_to_add_mod_list.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()); } // Release DRBs diff --git a/srsgnb/src/stack/rrc/rrc_nr_ue.cc b/srsgnb/src/stack/rrc/rrc_nr_ue.cc index 60ac3eeec..b287f28bb 100644 --- a/srsgnb/src/stack/rrc/rrc_nr_ue.cc +++ b/srsgnb/src/stack/rrc/rrc_nr_ue.cc @@ -968,7 +968,8 @@ 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, dummy_radio_bearer_cfg, next_cell_group_cfg); + fill_cellgroup_with_radio_bearer_cfg( + parent->cfg, old_rnti, *parent->bearer_mapper, dummy_radio_bearer_cfg, next_cell_group_cfg); // send RRC Reestablishment message and restore bearer configuration send_connection_reest(old_ue->sec_ctx.get_ncc()); @@ -1061,7 +1062,8 @@ void rrc_nr::ue::send_rrc_setup() // - Setup masterCellGroup // - Derive master cell group config bearers - fill_cellgroup_with_radio_bearer_cfg(parent->cfg, setup_ies.radio_bearer_cfg, next_cell_group_cfg); + fill_cellgroup_with_radio_bearer_cfg( + parent->cfg, rnti, *parent->bearer_mapper, setup_ies.radio_bearer_cfg, next_cell_group_cfg); // - Pack masterCellGroup into container srsran::unique_byte_buffer_t pdu = parent->pack_into_pdu(next_cell_group_cfg, __FUNCTION__); if (pdu == nullptr) { @@ -1209,7 +1211,8 @@ 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, ies.radio_bearer_cfg, master_cell_group); + fill_cellgroup_with_radio_bearer_cfg( + parent->cfg, rnti, *parent->bearer_mapper, ies.radio_bearer_cfg, master_cell_group); // Pack masterCellGroup into container srsran::unique_byte_buffer_t pdu = parent->pack_into_pdu(master_cell_group, __FUNCTION__);