diff --git a/srsgnb/hdr/stack/rrc/rrc_nr_ue.h b/srsgnb/hdr/stack/rrc/rrc_nr_ue.h index 84b4566c1..52243082e 100644 --- a/srsgnb/hdr/stack/rrc/rrc_nr_ue.h +++ b/srsgnb/hdr/stack/rrc/rrc_nr_ue.h @@ -186,7 +186,7 @@ private: // MAC controller sched_nr_interface::ue_cfg_t uecfg{}; - const uint32_t drb1_lcid = 4; + const uint32_t drb1_lcid = 4; uint32_t drb1_five_qi = 0; /// selected by 5GC // Security helper diff --git a/srsgnb/src/stack/rrc/cell_asn1_config.cc b/srsgnb/src/stack/rrc/cell_asn1_config.cc index 314811c49..17d99cba0 100644 --- a/srsgnb/src/stack/rrc/cell_asn1_config.cc +++ b/srsgnb/src/stack/rrc/cell_asn1_config.cc @@ -1348,7 +1348,7 @@ int 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; + uint32_t lcid = drb.drb_id + srsran::MAX_NR_SRB_ID; enb_bearer_manager::radio_bearer_t rb = bearer_mapper.get_lcid_bearer(rnti, lcid); 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()); diff --git a/srsgnb/src/stack/rrc/rrc_nr_ue.cc b/srsgnb/src/stack/rrc/rrc_nr_ue.cc index b7fb7ee6b..ac4fbe685 100644 --- a/srsgnb/src/stack/rrc/rrc_nr_ue.cc +++ b/srsgnb/src/stack/rrc/rrc_nr_ue.cc @@ -1340,29 +1340,36 @@ void rrc_nr::ue::establish_eps_bearer(uint32_t pdu_session_id, nas_pdu_queue.push_back(std::move(pdu)); // Add SRB2, if not yet added - if (radio_bearer_cfg.srb_to_add_mod_list.size() <= 1) { + asn1::rrc_nr::srb_to_add_mod_s* srb_it = + std::find_if(radio_bearer_cfg.srb_to_add_mod_list.begin(), + radio_bearer_cfg.srb_to_add_mod_list.end(), + [](const asn1::rrc_nr::srb_to_add_mod_s& srb) { return srb.srb_id == 2; }); + + if (srb_it == radio_bearer_cfg.srb_to_add_mod_list.end()) { next_radio_bearer_cfg.srb_to_add_mod_list.push_back(srb_to_add_mod_s{}); next_radio_bearer_cfg.srb_to_add_mod_list.back().srb_id = 2; } drb_to_add_mod_s drb; drb.cn_assoc_present = true; - drb.cn_assoc.set_sdap_cfg().pdu_session = 1; + drb.cn_assoc.set_sdap_cfg().pdu_session = pdu_session_id; drb.cn_assoc.sdap_cfg().sdap_hdr_dl.value = asn1::rrc_nr::sdap_cfg_s::sdap_hdr_dl_opts::absent; drb.cn_assoc.sdap_cfg().sdap_hdr_ul.value = asn1::rrc_nr::sdap_cfg_s::sdap_hdr_ul_opts::absent; drb.cn_assoc.sdap_cfg().default_drb = true; drb.cn_assoc.sdap_cfg().mapped_qos_flows_to_add.resize(1); drb.cn_assoc.sdap_cfg().mapped_qos_flows_to_add[0] = 1; - drb.drb_id = 1; + drb.drb_id = lcid - srsran::MAX_NR_SRB_ID; drb.pdcp_cfg_present = true; drb.pdcp_cfg = parent->cfg.five_qi_cfg[five_qi].pdcp_cfg; next_radio_bearer_cfg.drb_to_add_mod_list.push_back(drb); - parent->bearer_mapper->add_eps_bearer( - rnti, lcid - 3, srsran::srsran_rat_t::nr, lcid); // TODO: configurable bearer id <-> lcid mapping - parent->bearer_mapper->set_five_qi(rnti, lcid - 3, five_qi); + parent->bearer_mapper->add_eps_bearer(rnti, + pdu_session_id, + srsran::srsran_rat_t::nr, + lcid); // TODO: configurable bearer id <-> lcid mapping + parent->bearer_mapper->set_five_qi(rnti, pdu_session_id, five_qi); // store 5QI for possible reestablishment of DRB drb1_five_qi = five_qi;