From ac7fe9be6401356c5995d73d5fcdad6e02796424 Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Fri, 7 Jan 2022 12:54:49 +0100 Subject: [PATCH 1/7] sched,nr: make scheduler robust to errors in the phy that cause skipped slot indications --- srsgnb/hdr/stack/mac/sched_nr_worker.h | 2 ++ srsgnb/src/stack/mac/sched_nr_worker.cc | 20 +++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/srsgnb/hdr/stack/mac/sched_nr_worker.h b/srsgnb/hdr/stack/mac/sched_nr_worker.h index a7cffdc6a..22393048e 100644 --- a/srsgnb/hdr/stack/mac/sched_nr_worker.h +++ b/srsgnb/hdr/stack/mac/sched_nr_worker.h @@ -54,6 +54,8 @@ private: // {slot,cc} specific variables slot_ue_map_t slot_ues; + + slot_point last_tx_sl; }; } // namespace sched_nr_impl diff --git a/srsgnb/src/stack/mac/sched_nr_worker.cc b/srsgnb/src/stack/mac/sched_nr_worker.cc index 1792d6d26..633a946b6 100644 --- a/srsgnb/src/stack/mac/sched_nr_worker.cc +++ b/srsgnb/src/stack/mac/sched_nr_worker.cc @@ -36,12 +36,18 @@ void cc_worker::dl_rach_info(const sched_nr_interface::rar_info_t& rar_info) /// Called within a locked context, to generate {slot, cc} scheduling decision -dl_sched_res_t* cc_worker::run_slot(slot_point pdcch_slot, ue_map_t& ue_db) +dl_sched_res_t* cc_worker::run_slot(slot_point tx_sl, ue_map_t& ue_db) { // Reset old sched outputs - slot_point old_slot = pdcch_slot - TX_ENB_DELAY - 1; - for (bwp_manager& bwp : bwps) { - bwp.grid[old_slot].reset(); + if (not last_tx_sl.valid()) { + last_tx_sl = tx_sl; + } + while (last_tx_sl != tx_sl) { + last_tx_sl++; + slot_point old_slot = last_tx_sl - TX_ENB_DELAY - 1; + for (bwp_manager& bwp : bwps) { + bwp.grid[old_slot].reset(); + } } // Reserve UEs for this worker slot (select candidate UEs) @@ -53,7 +59,7 @@ dl_sched_res_t* cc_worker::run_slot(slot_point pdcch_slot, ue_map_t& ue_db) } // info for a given UE on a slot to be process - slot_ues.insert(rnti, u.make_slot_ue(pdcch_slot, cfg.cc)); + slot_ues.insert(rnti, u.make_slot_ue(tx_sl, cfg.cc)); if (slot_ues[rnti].empty()) { // Failed to generate slot UE because UE has no conditions for DL/UL tx slot_ues.erase(rnti); @@ -63,10 +69,10 @@ dl_sched_res_t* cc_worker::run_slot(slot_point pdcch_slot, ue_map_t& ue_db) } // Create an BWP allocator object that will passed along to RA, SI, Data schedulers - bwp_slot_allocator bwp_alloc{bwps[0].grid, pdcch_slot, slot_ues}; + bwp_slot_allocator bwp_alloc{bwps[0].grid, tx_sl, slot_ues}; // Log UEs state for slot - log_sched_slot_ues(logger, pdcch_slot, cfg.cc, slot_ues); + log_sched_slot_ues(logger, tx_sl, cfg.cc, slot_ues); // Allocate cell DL signalling sched_dl_signalling(bwp_alloc); From 8619382b45ee8801fb8e9281c2996bb2651a127b Mon Sep 17 00:00:00 2001 From: Alejandro Leal Date: Mon, 10 Jan 2022 13:46:54 +0100 Subject: [PATCH 2/7] Removed unneeded libraries from the mac test in srsgnb --- srsgnb/src/stack/mac/test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srsgnb/src/stack/mac/test/CMakeLists.txt b/srsgnb/src/stack/mac/test/CMakeLists.txt index c8bdba6d9..c28ced64e 100644 --- a/srsgnb/src/stack/mac/test/CMakeLists.txt +++ b/srsgnb/src/stack/mac/test/CMakeLists.txt @@ -41,7 +41,7 @@ target_link_libraries(sched_nr_rar_test srsgnb_mac sched_nr_test_suite srsran_co add_nr_test(sched_nr_rar_test sched_nr_rar_test) add_executable(sched_nr_dci_utilities_tests sched_nr_dci_utilities_tests.cc) -target_link_libraries(sched_nr_dci_utilities_tests srsgnb_mac srsran_common srsran_phch) +target_link_libraries(sched_nr_dci_utilities_tests srsgnb_mac srsran_common) add_nr_test(sched_nr_dci_utilities_tests sched_nr_dci_utilities_tests) add_executable(sched_nr_test sched_nr_test.cc) From 6c4c1ea1550aa14dab128af5365682cef4a54074 Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Mon, 10 Jan 2022 12:22:37 +0100 Subject: [PATCH 3/7] NR UE PHY: interfaced fix wideband CQI reporting in nr_phy_test --- lib/include/srsran/interfaces/ue_nr_interfaces.h | 5 ++--- srsue/hdr/phy/nr/state.h | 10 ++++++++++ test/phy/nr_phy_test.cc | 9 +++++---- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/lib/include/srsran/interfaces/ue_nr_interfaces.h b/lib/include/srsran/interfaces/ue_nr_interfaces.h index 7eba9de19..c2f359323 100644 --- a/lib/include/srsran/interfaces/ue_nr_interfaces.h +++ b/lib/include/srsran/interfaces/ue_nr_interfaces.h @@ -34,7 +34,7 @@ public: */ struct cell_search_result_t { bool cell_found = false; - uint32_t pci = 0; ///< Physical Cell Identifier + uint32_t pci = 0; ///< Physical Cell Identifier srsran_pbch_msg_nr_t pbch_msg; ///< Packed PBCH message for the upper layers srsran_csi_trs_measurements_t measurements = {}; ///< Measurements from SSB block }; @@ -191,7 +191,7 @@ struct phy_args_nr_t { srsran_ue_dl_nr_args_t dl = {}; srsran_ue_ul_nr_args_t ul = {}; std::set fixed_sr = {1}; - uint32_t fix_wideband_cqi = 15; // Set to a non-zero value for fixing the wide-band CQI report + uint32_t fix_wideband_cqi = 15; ///< Set to a non-zero value for fixing the wide-band CQI report bool store_pdsch_ko = false; float trs_epre_ema_alpha = 0.1f; ///< EPRE measurement exponential average alpha float trs_rsrp_ema_alpha = 0.1f; ///< RSRP measurement exponential average alpha @@ -222,7 +222,6 @@ struct phy_args_nr_t { class phy_interface_mac_nr { public: - // MAC informs PHY about UL grant included in RAR PDU virtual int set_rar_grant(uint32_t rar_slot_idx, std::array packed_ul_grant, diff --git a/srsue/hdr/phy/nr/state.h b/srsue/hdr/phy/nr/state.h index 83d4d7505..c3f51d2e9 100644 --- a/srsue/hdr/phy/nr/state.h +++ b/srsue/hdr/phy/nr/state.h @@ -361,6 +361,16 @@ public: uci_data.cfg.nof_csi = n; } + // Set fix wideband CQI if it is not zero nor greater than 15 + if (args.fix_wideband_cqi != 0 && args.fix_wideband_cqi < 15) { + for (uint32_t i = 0; i < uci_data.cfg.nof_csi; i++) { + if (uci_data.cfg.csi[i].cfg.quantity == SRSRAN_CSI_REPORT_QUANTITY_CRI_RI_PMI_CQI && + uci_data.cfg.csi[i].cfg.freq_cfg == SRSRAN_CSI_REPORT_FREQ_WIDEBAND) { + uci_data.value.csi[i].wideband_cri_ri_pmi_cqi.cqi = args.fix_wideband_cqi; + } + } + } + uci_data.cfg.pucch.rnti = stack->get_ul_sched_rnti_nr(slot_cfg.idx).id; } diff --git a/test/phy/nr_phy_test.cc b/test/phy/nr_phy_test.cc index bbc94996b..fe99edc1f 100644 --- a/test/phy/nr_phy_test.cc +++ b/test/phy/nr_phy_test.cc @@ -87,10 +87,11 @@ test_bench::args_t::args_t(int argc, char** argv) ; options_ue_phy.add_options() - ("ue.phy.nof_threads", bpo::value(&ue_phy.nof_phy_threads)->default_value(1), "Number of threads") - ("ue.phy.log.level", bpo::value(&ue_phy.log.phy_level)->default_value("warning"), "UE PHY log level") - ("ue.phy.log.hex_limit", bpo::value(&ue_phy.log.phy_hex_limit)->default_value(0), "UE PHY log hex limit") - ("ue.phy.log.id_preamble", bpo::value(&ue_phy.log.id_preamble)->default_value(" UE/"), "UE PHY log ID preamble") + ("ue.phy.fix_wideband_cqi", bpo::value(&ue_phy.fix_wideband_cqi)->default_value(15), "Fix wideband CQI value, set to 0 or greater than 15 to disable") + ("ue.phy.nof_threads", bpo::value(&ue_phy.nof_phy_threads)->default_value(1), "Number of threads") + ("ue.phy.log.level", bpo::value(&ue_phy.log.phy_level)->default_value("warning"), "UE PHY log level") + ("ue.phy.log.hex_limit", bpo::value(&ue_phy.log.phy_hex_limit)->default_value(0), "UE PHY log hex limit") + ("ue.phy.log.id_preamble", bpo::value(&ue_phy.log.id_preamble)->default_value(" UE/"), "UE PHY log ID preamble") ; options_ue_stack.add_options() From a9724fced1149178233cc5f4721b143e074cfff1 Mon Sep 17 00:00:00 2001 From: Fabian Eckermann Date: Wed, 15 Dec 2021 09:53:30 +0100 Subject: [PATCH 4/7] Remove unused code from test. --- srsue/src/stack/rrc_nr/test/ue_rrc_nr_test.cc | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/srsue/src/stack/rrc_nr/test/ue_rrc_nr_test.cc b/srsue/src/stack/rrc_nr/test/ue_rrc_nr_test.cc index d2f966224..1783bd232 100644 --- a/srsue/src/stack/rrc_nr/test/ue_rrc_nr_test.cc +++ b/srsue/src/stack/rrc_nr/test/ue_rrc_nr_test.cc @@ -231,13 +231,7 @@ int rrc_nsa_reconfig_tdd_test() asn1::rrc_nr::rrc_recfg_s secondary_cell_group_r15; TESTASSERT(secondary_cell_group_r15.unpack(bref0) == asn1::SRSASN_SUCCESS); - TESTASSERT(secondary_cell_group_r15.crit_exts.rrc_recfg().secondary_cell_group_present); - asn1::cbit_ref bref1(secondary_cell_group_r15.crit_exts.rrc_recfg().secondary_cell_group.data(), - secondary_cell_group_r15.crit_exts.rrc_recfg().secondary_cell_group.size()); - - asn1::rrc_nr::cell_group_cfg_s cell_group_cfg; - cell_group_cfg.unpack(bref1); rrc_nr_reconf.crit_exts.rrc_recfg().secondary_cell_group_present = true; rrc_nr_reconf.crit_exts.rrc_recfg().secondary_cell_group = @@ -337,13 +331,7 @@ int rrc_nsa_reconfig_fdd_test() asn1::rrc_nr::rrc_recfg_s secondary_cell_group_r15; TESTASSERT(secondary_cell_group_r15.unpack(bref0) == asn1::SRSASN_SUCCESS); - TESTASSERT(secondary_cell_group_r15.crit_exts.rrc_recfg().secondary_cell_group_present); - asn1::cbit_ref bref1(secondary_cell_group_r15.crit_exts.rrc_recfg().secondary_cell_group.data(), - secondary_cell_group_r15.crit_exts.rrc_recfg().secondary_cell_group.size()); - - asn1::rrc_nr::cell_group_cfg_s cell_group_cfg; - TESTASSERT(cell_group_cfg.unpack(bref1) == asn1::SRSASN_SUCCESS); rrc_nr_reconf.crit_exts.rrc_recfg().secondary_cell_group_present = true; rrc_nr_reconf.crit_exts.rrc_recfg().secondary_cell_group = From a6c1098afe70eaa6d51145a8e57f8d2ad1012b6a Mon Sep 17 00:00:00 2001 From: Fabian Eckermann Date: Mon, 13 Dec 2021 16:18:18 +0100 Subject: [PATCH 5/7] Add decoding of RRC reconfiguration. --- srsue/hdr/stack/rrc_nr/rrc_nr.h | 1 + srsue/src/stack/rrc_nr/rrc_nr.cc | 27 +++++++++- srsue/src/stack/rrc_nr/rrc_nr_procedures.cc | 57 +++++++++++++++++---- 3 files changed, 74 insertions(+), 11 deletions(-) diff --git a/srsue/hdr/stack/rrc_nr/rrc_nr.h b/srsue/hdr/stack/rrc_nr/rrc_nr.h index f5d3d6d43..bb1f3fad8 100644 --- a/srsue/hdr/stack/rrc_nr/rrc_nr.h +++ b/srsue/hdr/stack/rrc_nr/rrc_nr.h @@ -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 { diff --git a/srsue/src/stack/rrc_nr/rrc_nr.cc b/srsue/src/stack/rrc_nr/rrc_nr.cc index 808c57f61..403926bd1 100644 --- a/srsue/src/stack/rrc_nr/rrc_nr.cc +++ b/srsue/src/stack/rrc_nr/rrc_nr.cc @@ -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() {} diff --git a/srsue/src/stack/rrc_nr/rrc_nr_procedures.cc b/srsue/src/stack/rrc_nr/rrc_nr_procedures.cc index a41279070..b779522b4 100644 --- a/srsue/src/stack/rrc_nr/rrc_nr_procedures.cc +++ b/srsue/src/stack/rrc_nr/rrc_nr_procedures.cc @@ -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; } From cb6809c9b2ba7cac6f64c4b025d4e231f42873d3 Mon Sep 17 00:00:00 2001 From: Fabian Eckermann Date: Mon, 13 Dec 2021 16:19:09 +0100 Subject: [PATCH 6/7] Add SA RRC reconfiguration test. --- srsue/src/stack/rrc_nr/test/ue_rrc_nr_test.cc | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/srsue/src/stack/rrc_nr/test/ue_rrc_nr_test.cc b/srsue/src/stack/rrc_nr/test/ue_rrc_nr_test.cc index 1783bd232..328d0ae90 100644 --- a/srsue/src/stack/rrc_nr/test/ue_rrc_nr_test.cc +++ b/srsue/src/stack/rrc_nr/test/ue_rrc_nr_test.cc @@ -497,6 +497,57 @@ int rrc_nr_setup_test() return SRSRAN_SUCCESS; } +int rrc_nr_reconfig_test() +{ + srslog::basic_logger& logger = srslog::fetch_basic_logger("RRC-NR"); + logger.set_level(srslog::basic_levels::debug); + logger.set_hex_dump_max_size(-1); + srsran::task_scheduler task_sched{512, 100}; + srsran::task_sched_handle task_sched_handle(&task_sched); + rrc_nr rrc_nr(task_sched_handle); + + dummy_phy dummy_phy; + dummy_mac dummy_mac; + dummy_rlc dummy_rlc; + dummy_pdcp dummy_pdcp; + dummy_gw dummy_gw; + dummy_eutra dummy_eutra; + dummy_sim dummy_sim; + dummy_stack dummy_stack; + rrc_nr_args_t rrc_nr_args; + TESTASSERT(rrc_nr.init(&dummy_phy, + &dummy_mac, + &dummy_rlc, + &dummy_pdcp, + &dummy_gw, + &dummy_eutra, + &dummy_sim, + task_sched.get_timer_handler(), + &dummy_stack, + rrc_nr_args) == SRSRAN_SUCCESS); + + uint8_t msg[] = {0x04, 0x8a, 0x80, 0x40, 0x9a, 0x01, 0xe0, 0x02, 0x05, 0xe1, 0xf0, 0x05, 0x00, 0x9a, 0x00, 0x15, 0x84, + 0x88, 0x8b, 0xd7, 0x63, 0x80, 0x83, 0x2f, 0x00, 0x05, 0x8e, 0x03, 0xea, 0x41, 0xd0, 0x23, 0x00, 0x20, + 0x25, 0x5f, 0x80, 0xa2, 0xef, 0x22, 0xc8, 0x40, 0xdf, 0x80, 0x1a, 0x00, 0x40, 0x21, 0x8b, 0x80, 0x40, + 0x70, 0x84, 0xc0, 0x02, 0x40, 0x40, 0x01, 0x8c, 0x4c, 0x40, 0x40, 0x7f, 0xc0, 0x41, 0x82, 0xc0, 0x00, + 0x42, 0xc0, 0x00, 0x4a, 0x43, 0x40, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x82, 0x8b, 0x40, + 0x01, 0x88, 0x80, 0x40, 0x5e, 0x40, 0x01, 0x80, 0x48, 0x10, 0x40, 0x40, 0x42, 0x5e, 0xc0, 0x12, 0x20, + 0x20, 0x08, 0x44, 0x00, 0x80, 0x00, 0x04, 0x20, 0x41, 0x82, 0x02, 0x02, 0x02, 0x20, 0xc1, 0x82, 0x02, + 0x01, 0x01, 0x00, 0x00, 0xc4, 0x08, 0x00, 0x52, 0x18, 0x12, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x22, 0x22, 0x00, 0x00, 0xc4, 0x08, 0x00, 0x52, 0x18, 0x12, 0x18, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x22, 0x11, 0x00, 0x03, 0x41, 0x02, 0x02, 0x02, 0x02, 0x00, 0x03, 0x41, 0x02, + 0x02, 0x01, 0x01, 0x09, 0x41, 0xc1, 0x9c, 0xdc, 0x9c, 0xd8, 0x5c, 0x1b, 0x84, 0x80, 0x40}; + + srsran::unique_byte_buffer_t pdu = srsran::make_byte_buffer(); + memcpy(pdu->msg, msg, sizeof(msg)); + pdu->N_bytes = sizeof(msg); + + rrc_nr.write_pdu(1, std::move(pdu)); + task_sched.run_pending_tasks(); + + return SRSRAN_SUCCESS; +} + int main(int argc, char** argv) { srslog::init(); @@ -507,6 +558,7 @@ int main(int argc, char** argv) TESTASSERT(rrc_nr_setup_request_test() == SRSRAN_SUCCESS); TESTASSERT(rrc_nr_sib1_decoding_test() == SRSRAN_SUCCESS); TESTASSERT(rrc_nr_setup_test() == SRSRAN_SUCCESS); + TESTASSERT(rrc_nr_reconfig_test() == SRSRAN_SUCCESS); return SRSRAN_SUCCESS; } From 4182a9f1642ca92e431a36bd84f987c6ec995e6c Mon Sep 17 00:00:00 2001 From: Fabian Eckermann Date: Mon, 10 Jan 2022 10:10:30 +0100 Subject: [PATCH 7/7] Add cell group update without random access. --- srsue/hdr/stack/rrc_nr/rrc_nr.h | 2 ++ srsue/src/stack/rrc_nr/rrc_nr.cc | 24 +++++++++++++++++---- srsue/src/stack/rrc_nr/rrc_nr_procedures.cc | 12 +++-------- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/srsue/hdr/stack/rrc_nr/rrc_nr.h b/srsue/hdr/stack/rrc_nr/rrc_nr.h index bb1f3fad8..31ced245b 100644 --- a/srsue/hdr/stack/rrc_nr/rrc_nr.h +++ b/srsue/hdr/stack/rrc_nr/rrc_nr.h @@ -213,10 +213,12 @@ private: std::map csi_rs_nzp_res; bool apply_cell_group_cfg(const asn1::rrc_nr::cell_group_cfg_s& cell_group_cfg); + bool update_cell_group_cfg(const asn1::rrc_nr::cell_group_cfg_s& cell_group_cfg); bool apply_radio_bearer_cfg(const asn1::rrc_nr::radio_bearer_cfg_s& radio_bearer_cfg); bool apply_rlc_add_mod(const asn1::rrc_nr::rlc_bearer_cfg_s& rlc_bearer_cfg); bool apply_mac_cell_group(const asn1::rrc_nr::mac_cell_group_cfg_s& mac_cell_group_cfg); bool apply_sp_cell_cfg(const asn1::rrc_nr::sp_cell_cfg_s& sp_cell_cfg); + bool update_sp_cell_cfg(const asn1::rrc_nr::sp_cell_cfg_s& sp_cell_cfg); bool apply_phy_cell_group_cfg(const asn1::rrc_nr::phys_cell_group_cfg_s& phys_cell_group_cfg); bool apply_dl_common_cfg(const asn1::rrc_nr::dl_cfg_common_s& dl_cfg_common); bool apply_ul_common_cfg(const asn1::rrc_nr::ul_cfg_common_s& ul_cfg_common); diff --git a/srsue/src/stack/rrc_nr/rrc_nr.cc b/srsue/src/stack/rrc_nr/rrc_nr.cc index 403926bd1..345f02805 100644 --- a/srsue/src/stack/rrc_nr/rrc_nr.cc +++ b/srsue/src/stack/rrc_nr/rrc_nr.cc @@ -1569,6 +1569,15 @@ bool rrc_nr::apply_sp_cell_ded_ul_pusch(const asn1::rrc_nr::pusch_cfg_s& pusch_c }; bool rrc_nr::apply_sp_cell_cfg(const sp_cell_cfg_s& sp_cell_cfg) +{ + update_sp_cell_cfg(sp_cell_cfg); + + phy_cfg_state = PHY_CFG_STATE_APPLY_SP_CELL; + + return true; +} + +bool rrc_nr::update_sp_cell_cfg(const sp_cell_cfg_s& sp_cell_cfg) { srsran_csi_hl_cfg_t prev_csi = phy_cfg.csi; if (sp_cell_cfg.recfg_with_sync_present) { @@ -1621,7 +1630,7 @@ bool rrc_nr::apply_sp_cell_cfg(const sp_cell_cfg_s& sp_cell_cfg) } } } else { - logger.warning("Reconfig with with sync not present"); + logger.warning("Reconfig with sync not present"); } // Dedicated config @@ -1740,8 +1749,6 @@ bool rrc_nr::apply_sp_cell_cfg(const sp_cell_cfg_s& sp_cell_cfg) current_phycfg.csi = prev_csi; phy->set_config(current_phycfg); - phy_cfg_state = PHY_CFG_STATE_APPLY_SP_CELL; - return true; } @@ -1758,6 +1765,15 @@ bool rrc_nr::apply_phy_cell_group_cfg(const phys_cell_group_cfg_s& phys_cell_gro } bool rrc_nr::apply_cell_group_cfg(const cell_group_cfg_s& cell_group_cfg) +{ + update_cell_group_cfg(cell_group_cfg); + + phy_cfg_state = PHY_CFG_STATE_APPLY_SP_CELL; + + return true; +} + +bool rrc_nr::update_cell_group_cfg(const cell_group_cfg_s& cell_group_cfg) { if (cell_group_cfg.rlc_bearer_to_add_mod_list_present) { for (uint32_t i = 0; i < cell_group_cfg.rlc_bearer_to_add_mod_list.size(); i++) { @@ -1777,7 +1793,7 @@ bool rrc_nr::apply_cell_group_cfg(const cell_group_cfg_s& cell_group_cfg) } } if (cell_group_cfg.sp_cell_cfg_present) { - if (apply_sp_cell_cfg(cell_group_cfg.sp_cell_cfg) == false) { + if (update_sp_cell_cfg(cell_group_cfg.sp_cell_cfg) == false) { return false; } } diff --git a/srsue/src/stack/rrc_nr/rrc_nr_procedures.cc b/srsue/src/stack/rrc_nr/rrc_nr_procedures.cc index b779522b4..5f93e6fbf 100644 --- a/srsue/src/stack/rrc_nr/rrc_nr_procedures.cc +++ b/srsue/src/stack/rrc_nr/rrc_nr_procedures.cc @@ -34,11 +34,9 @@ proc_outcome_t rrc_nr::connection_reconf_no_ho_proc::init(const reconf_initiator Info("Starting..."); initiator = initiator_; -#if 0 asn1::json_writer js; rrc_nr_reconf.to_json(js); Debug("RRC NR Reconfiguration: %s", js.to_string().c_str()); -#endif 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) { @@ -55,11 +53,9 @@ proc_outcome_t rrc_nr::connection_reconf_no_ho_proc::init(const reconf_initiator return proc_outcome_t::error; } -#if 0 asn1::json_writer js1; secondary_cell_group_cfg.to_json(js1); Debug("Secondary Cell Group: %s", js1.to_string().c_str()); -#endif Info("Applying Secondary Cell Group Cfg."); if (!rrc_handle.apply_cell_group_cfg(secondary_cell_group_cfg)) { @@ -85,11 +81,9 @@ proc_outcome_t rrc_nr::connection_reconf_no_ho_proc::init(const reconf_initiator 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)) { @@ -168,7 +162,7 @@ void rrc_nr::connection_reconf_no_ho_proc::then(const srsran::proc_state_t& resu *************************************/ rrc_nr::setup_request_proc::setup_request_proc(rrc_nr& parent_) : - rrc_handle(parent_), logger(srslog::fetch_basic_logger("RRC")) + rrc_handle(parent_), logger(srslog::fetch_basic_logger("RRC-NR")) {} proc_outcome_t rrc_nr::setup_request_proc::init(srsran::nr_establishment_cause_t cause_, @@ -293,7 +287,7 @@ srsran::proc_outcome_t rrc_nr::setup_request_proc::react(const cell_selection_pr // Simple procedure mainly do defer the transmission of the SetupComplete until all PHY reconfiguration are done rrc_nr::connection_setup_proc::connection_setup_proc(srsue::rrc_nr& parent_) : - rrc_handle(parent_), logger(srslog::fetch_basic_logger("RRC")) + rrc_handle(parent_), logger(srslog::fetch_basic_logger("RRC-NR")) {} srsran::proc_outcome_t rrc_nr::connection_setup_proc::init(const asn1::rrc_nr::radio_bearer_cfg_s radio_bearer_cfg_, @@ -315,7 +309,7 @@ srsran::proc_outcome_t rrc_nr::connection_setup_proc::init(const asn1::rrc_nr::r } // Apply the Cell Group configuration - if (!rrc_handle.apply_cell_group_cfg(cell_group_)) { + if (!rrc_handle.update_cell_group_cfg(cell_group_)) { return proc_outcome_t::error; }