From b8006534f0364528ffc40176e3d0e61f536b366b Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Tue, 8 Mar 2022 15:24:12 +0000 Subject: [PATCH] gnb,ngap,rrc_nr: Passing 5QI from the NGAP to the RRC when establishing eps bearers. Filling PDCP-NR config from 5QI config. --- .../srsran/interfaces/gnb_rrc_nr_interfaces.h | 25 +++++++++++-------- srsgnb/hdr/stack/rrc/rrc_nr.h | 3 ++- srsgnb/hdr/stack/rrc/rrc_nr_ue.h | 2 +- srsgnb/src/stack/ngap/ngap_ue_proc.cc | 6 ++++- srsgnb/src/stack/ngap/test/ngap_test.cc | 6 ++++- srsgnb/src/stack/rrc/rrc_nr.cc | 8 ++++-- srsgnb/src/stack/rrc/rrc_nr_ue.cc | 20 ++++++--------- .../src/stack/rrc/test/rrc_nr_test_helpers.cc | 2 +- 8 files changed, 41 insertions(+), 31 deletions(-) diff --git a/lib/include/srsran/interfaces/gnb_rrc_nr_interfaces.h b/lib/include/srsran/interfaces/gnb_rrc_nr_interfaces.h index aaa81a1bf..1717dc238 100644 --- a/lib/include/srsran/interfaces/gnb_rrc_nr_interfaces.h +++ b/lib/include/srsran/interfaces/gnb_rrc_nr_interfaces.h @@ -20,17 +20,20 @@ namespace srsenb { class rrc_interface_ngap_nr { public: - virtual int ue_set_security_cfg_key(uint16_t rnti, const asn1::fixed_bitstring<256, false, true>& key) = 0; - virtual int ue_set_bitrates(uint16_t rnti, const asn1::ngap::ue_aggregate_maximum_bit_rate_s& rates) = 0; - virtual int set_aggregate_max_bitrate(uint16_t rnti, const asn1::ngap::ue_aggregate_maximum_bit_rate_s& rates) = 0; - virtual int ue_set_security_cfg_capabilities(uint16_t rnti, const asn1::ngap::ue_security_cap_s& caps) = 0; - virtual int start_security_mode_procedure(uint16_t rnti, srsran::unique_byte_buffer_t nas_pdu) = 0; - virtual int - establish_rrc_bearer(uint16_t rnti, uint16_t pdu_session_id, srsran::const_byte_span nas_pdu, uint32_t lcid) = 0; - virtual int allocate_lcid(uint16_t rnti) = 0; - virtual int release_bearers(uint16_t rnti) = 0; - virtual void release_user(uint16_t rnti) = 0; - virtual void write_dl_info(uint16_t rnti, srsran::unique_byte_buffer_t sdu) = 0; + virtual int ue_set_security_cfg_key(uint16_t rnti, const asn1::fixed_bitstring<256, false, true>& key) = 0; + virtual int ue_set_bitrates(uint16_t rnti, const asn1::ngap::ue_aggregate_maximum_bit_rate_s& rates) = 0; + virtual int set_aggregate_max_bitrate(uint16_t rnti, const asn1::ngap::ue_aggregate_maximum_bit_rate_s& rates) = 0; + virtual int ue_set_security_cfg_capabilities(uint16_t rnti, const asn1::ngap::ue_security_cap_s& caps) = 0; + virtual int start_security_mode_procedure(uint16_t rnti, srsran::unique_byte_buffer_t nas_pdu) = 0; + virtual int establish_rrc_bearer(uint16_t rnti, + uint16_t pdu_session_id, + srsran::const_byte_span nas_pdu, + uint32_t lcid, + uint32_t five_qi) = 0; + virtual int allocate_lcid(uint16_t rnti) = 0; + virtual int release_bearers(uint16_t rnti) = 0; + virtual void release_user(uint16_t rnti) = 0; + virtual void write_dl_info(uint16_t rnti, srsran::unique_byte_buffer_t sdu) = 0; }; } // namespace srsenb diff --git a/srsgnb/hdr/stack/rrc/rrc_nr.h b/srsgnb/hdr/stack/rrc/rrc_nr.h index a82aafdc7..fae1cf979 100644 --- a/srsgnb/hdr/stack/rrc/rrc_nr.h +++ b/srsgnb/hdr/stack/rrc/rrc_nr.h @@ -102,7 +102,8 @@ public: int establish_rrc_bearer(uint16_t rnti, uint16_t pdu_session_id, srsran::const_byte_span nas_pdu, - uint32_t lcid) final; + uint32_t lcid, + uint32_t five_qi) final; int release_bearers(uint16_t rnti) final; void release_user(uint16_t rnti) final; void write_dl_info(uint16_t rnti, srsran::unique_byte_buffer_t sdu) final; diff --git a/srsgnb/hdr/stack/rrc/rrc_nr_ue.h b/srsgnb/hdr/stack/rrc/rrc_nr_ue.h index 4240ed82a..37035746a 100644 --- a/srsgnb/hdr/stack/rrc/rrc_nr_ue.h +++ b/srsgnb/hdr/stack/rrc/rrc_nr_ue.h @@ -79,7 +79,7 @@ public: void handle_ul_information_transfer(const asn1::rrc_nr::ul_info_transfer_s& msg); // NGAP interface - void establish_eps_bearer(uint32_t pdu_session_id, srsran::const_byte_span nas_pdu, uint32_t lcid); + void establish_eps_bearer(uint32_t pdu_session_id, srsran::const_byte_span nas_pdu, uint32_t lcid, uint32_t five_qi); /* TS 38.331 - 5.3.4 Initial AS security activation */ void send_security_mode_command(srsran::unique_byte_buffer_t nas_pdu); diff --git a/srsgnb/src/stack/ngap/ngap_ue_proc.cc b/srsgnb/src/stack/ngap/ngap_ue_proc.cc index 17512d922..a18d4fd61 100644 --- a/srsgnb/src/stack/ngap/ngap_ue_proc.cc +++ b/srsgnb/src/stack/ngap/ngap_ue_proc.cc @@ -92,9 +92,13 @@ proc_outcome_t ngap_ue_pdu_session_res_setup_proc::init(const asn1::ngap::pdu_se teid_in, addr_in.to_string()); + uint16_t five_qi = pdu_ses_res_setup_req_trans->qos_flow_setup_request_list.value[0] + .qos_flow_level_qos_params.qos_characteristics.non_dynamic5_qi() + .five_qi; + // QoS parameter mapping in config in LTE enb if (su_req.pdu_session_nas_pdu.size() > 0) { - if (rrc->establish_rrc_bearer(ue_ctxt->rnti, su_req.pdu_session_id, su_req.pdu_session_nas_pdu, lcid) == + if (rrc->establish_rrc_bearer(ue_ctxt->rnti, su_req.pdu_session_id, su_req.pdu_session_nas_pdu, lcid, five_qi) == SRSRAN_SUCCESS) { parent->send_pdu_session_resource_setup_response(su_req.pdu_session_id, teid_in, addr_in); return proc_outcome_t::success; diff --git a/srsgnb/src/stack/ngap/test/ngap_test.cc b/srsgnb/src/stack/ngap/test/ngap_test.cc index 8bd6803ac..93038819e 100644 --- a/srsgnb/src/stack/ngap/test/ngap_test.cc +++ b/srsgnb/src/stack/ngap/test/ngap_test.cc @@ -108,7 +108,11 @@ public: sec_mod_proc_started = true; return SRSRAN_SUCCESS; } - int establish_rrc_bearer(uint16_t rnti, uint16_t pdu_session_id, srsran::const_byte_span nas_pdu, uint32_t lcid) + int establish_rrc_bearer(uint16_t rnti, + uint16_t pdu_session_id, + srsran::const_byte_span nas_pdu, + uint32_t lcid, + uint32_t five_qi) { rrc_logger.info("Establish RRC bearer"); return SRSRAN_SUCCESS; diff --git a/srsgnb/src/stack/rrc/rrc_nr.cc b/srsgnb/src/stack/rrc/rrc_nr.cc index 5ff6a49a0..2b04b7857 100644 --- a/srsgnb/src/stack/rrc/rrc_nr.cc +++ b/srsgnb/src/stack/rrc/rrc_nr.cc @@ -648,14 +648,18 @@ int rrc_nr::start_security_mode_procedure(uint16_t rnti, srsran::unique_byte_buf user_it->second->send_security_mode_command(std::move(nas_pdu)); return SRSRAN_SUCCESS; } -int rrc_nr::establish_rrc_bearer(uint16_t rnti, uint16_t pdu_session_id, srsran::const_byte_span nas_pdu, uint32_t lcid) +int rrc_nr::establish_rrc_bearer(uint16_t rnti, + uint16_t pdu_session_id, + srsran::const_byte_span nas_pdu, + uint32_t lcid, + uint32_t five_qi) { if (not users.contains(rnti)) { logger.error("Establishing RRC bearers for inexistent rnti=0x%x", rnti); return SRSRAN_ERROR; } - users[rnti]->establish_eps_bearer(pdu_session_id, nas_pdu, lcid); + users[rnti]->establish_eps_bearer(pdu_session_id, nas_pdu, lcid, five_qi); // TODO: verify whether this is the best place where to call the RRCReconfig users[rnti]->send_rrc_reconfiguration(); diff --git a/srsgnb/src/stack/rrc/rrc_nr_ue.cc b/srsgnb/src/stack/rrc/rrc_nr_ue.cc index 65f6fdc1a..b6f8a3692 100644 --- a/srsgnb/src/stack/rrc/rrc_nr_ue.cc +++ b/srsgnb/src/stack/rrc/rrc_nr_ue.cc @@ -1316,7 +1316,10 @@ void rrc_nr::ue::handle_ul_information_transfer(const asn1::rrc_nr::ul_info_tran parent->ngap->write_pdu(rnti, msg.crit_exts.ul_info_transfer().ded_nas_msg); } -void rrc_nr::ue::establish_eps_bearer(uint32_t pdu_session_id, srsran::const_byte_span nas_pdu, uint32_t lcid) +void rrc_nr::ue::establish_eps_bearer(uint32_t pdu_session_id, + srsran::const_byte_span nas_pdu, + uint32_t lcid, + uint32_t five_qi) { // Enqueue NAS PDU srsran::unique_byte_buffer_t pdu = srsran::make_byte_buffer(); @@ -1343,18 +1346,9 @@ void rrc_nr::ue::establish_eps_bearer(uint32_t pdu_session_id, srsran::const_byt 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.pdcp_cfg_present = true; - drb.pdcp_cfg.drb_present = true; - drb.pdcp_cfg.drb.discard_timer_present = true; - drb.pdcp_cfg.drb.discard_timer.value = pdcp_cfg_s::drb_s_::discard_timer_opts::ms100; - drb.pdcp_cfg.drb.pdcp_sn_size_ul_present = true; - drb.pdcp_cfg.drb.pdcp_sn_size_ul.value = asn1::rrc_nr::pdcp_cfg_s::drb_s_::pdcp_sn_size_ul_opts::len18bits; - drb.pdcp_cfg.drb.pdcp_sn_size_dl_present = true; - drb.pdcp_cfg.drb.pdcp_sn_size_dl.value = asn1::rrc_nr::pdcp_cfg_s::drb_s_::pdcp_sn_size_dl_opts::len18bits; - drb.pdcp_cfg.drb.hdr_compress.set_not_used(); - drb.pdcp_cfg.t_reordering_present = true; - drb.pdcp_cfg.t_reordering.value = asn1::rrc_nr::pdcp_cfg_s::t_reordering_opts::ms0; + drb.drb_id = 1; + 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); diff --git a/srsgnb/src/stack/rrc/test/rrc_nr_test_helpers.cc b/srsgnb/src/stack/rrc/test/rrc_nr_test_helpers.cc index 047693a09..c183437bf 100644 --- a/srsgnb/src/stack/rrc/test/rrc_nr_test_helpers.cc +++ b/srsgnb/src/stack/rrc/test/rrc_nr_test_helpers.cc @@ -315,7 +315,7 @@ void test_rrc_nr_2nd_reconfiguration(srsran::task_scheduler& task_sched, NAS_msg.from_string("c574defc80ba722bffb8eacb6f8a163e3222cf1542ac529f6980bb15e0bf12d9f2b29f11fb458ec9"); // STEP 2 - Trigger and send RRCReconfiguration command (gNB -> UE) - rrc_obj.establish_rrc_bearer(rnti, 1, NAS_msg, srsran::srb_to_lcid(srsran::nr_srb::srb1)); + rrc_obj.establish_rrc_bearer(rnti, 1, NAS_msg, srsran::srb_to_lcid(srsran::nr_srb::srb1), 9); // Test whether there exists the SRB1 initiated in the Connection Establishment // We test this as the SRB1 was set up in a different function