From be4033608989619b8b8c0d518cebed0cdd8494d3 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Mon, 17 Oct 2022 16:14:02 +0200 Subject: [PATCH] all: mark various function args as const& to avoid pass by value --- lib/include/srsran/interfaces/enb_rlc_interfaces.h | 2 +- srsenb/hdr/stack/upper/rlc.h | 2 +- srsenb/src/stack/rrc/rrc_endc.cc | 2 +- srsenb/src/stack/upper/rlc.cc | 2 +- srsenb/test/common/dummy_classes_common.h | 2 +- srsgnb/src/stack/mac/mac_nr.cc | 2 +- srsue/hdr/phy/scell/intra_measure_base.h | 2 +- srsue/hdr/phy/scell/intra_measure_lte.h | 2 +- srsue/hdr/phy/scell/intra_measure_nr.h | 2 +- srsue/hdr/stack/rrc_nr/rrc_nr_procedures.h | 6 +++--- srsue/hdr/stack/upper/nas_5g_procedures.h | 2 +- srsue/src/phy/scell/intra_measure_lte.cc | 2 +- srsue/src/phy/scell/intra_measure_nr.cc | 2 +- srsue/src/stack/rrc_nr/rrc_nr_procedures.cc | 6 +++--- srsue/src/stack/upper/nas_5g_procedures.cc | 4 ++-- 15 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/include/srsran/interfaces/enb_rlc_interfaces.h b/lib/include/srsran/interfaces/enb_rlc_interfaces.h index ff0e6dec5..4ceb5aeca 100644 --- a/lib/include/srsran/interfaces/enb_rlc_interfaces.h +++ b/lib/include/srsran/interfaces/enb_rlc_interfaces.h @@ -51,7 +51,7 @@ public: virtual void clear_buffer(uint16_t rnti) = 0; virtual void add_user(uint16_t rnti) = 0; virtual void rem_user(uint16_t rnti) = 0; - virtual void add_bearer(uint16_t rnti, uint32_t lcid, srsran::rlc_config_t cnfg) = 0; + virtual void add_bearer(uint16_t rnti, uint32_t lcid, const srsran::rlc_config_t& cnfg) = 0; virtual void add_bearer_mrb(uint16_t rnti, uint32_t lcid) = 0; virtual void del_bearer(uint16_t rnti, uint32_t lcid) = 0; virtual void write_sdu(uint16_t rnti, uint32_t lcid, srsran::unique_byte_buffer_t sdu) = 0; diff --git a/srsenb/hdr/stack/upper/rlc.h b/srsenb/hdr/stack/upper/rlc.h index 55526b0aa..73a8ecb81 100644 --- a/srsenb/hdr/stack/upper/rlc.h +++ b/srsenb/hdr/stack/upper/rlc.h @@ -47,7 +47,7 @@ public: void clear_buffer(uint16_t rnti); void add_user(uint16_t rnti); void rem_user(uint16_t rnti); - void add_bearer(uint16_t rnti, uint32_t lcid, srsran::rlc_config_t cnfg); + void add_bearer(uint16_t rnti, uint32_t lcid, const srsran::rlc_config_t& cnfg); void add_bearer_mrb(uint16_t rnti, uint32_t lcid); void del_bearer(uint16_t rnti, uint32_t lcid); bool has_bearer(uint16_t rnti, uint32_t lcid); diff --git a/srsenb/src/stack/rrc/rrc_endc.cc b/srsenb/src/stack/rrc/rrc_endc.cc index c6b39f4b6..5a3bc7438 100644 --- a/srsenb/src/stack/rrc/rrc_endc.cc +++ b/srsenb/src/stack/rrc/rrc_endc.cc @@ -155,7 +155,7 @@ bool rrc::ue::rrc_endc::fill_conn_recfg(asn1::rrc::rrc_conn_recfg_r8_ies_s* conn meas_cfg.meas_id_to_rem_list.resize(1); meas_cfg.meas_id_to_rem_list[0] = nr_meas_id; - // FIXME: use bearer manager to remove EUTRA DRB + // TODO: use bearer manager to remove EUTRA DRB conn_recfg->rr_cfg_ded.drb_to_release_list_present = true; conn_recfg->rr_cfg_ded.drb_to_release_list.resize(1); conn_recfg->rr_cfg_ded.drb_to_release_list[0] = 1; diff --git a/srsenb/src/stack/upper/rlc.cc b/srsenb/src/stack/upper/rlc.cc index b0a830518..c3f5b16a7 100644 --- a/srsenb/src/stack/upper/rlc.cc +++ b/srsenb/src/stack/upper/rlc.cc @@ -103,7 +103,7 @@ void rlc::clear_buffer(uint16_t rnti) pthread_rwlock_unlock(&rwlock); } -void rlc::add_bearer(uint16_t rnti, uint32_t lcid, srsran::rlc_config_t cnfg) +void rlc::add_bearer(uint16_t rnti, uint32_t lcid, const srsran::rlc_config_t& cnfg) { pthread_rwlock_rdlock(&rwlock); if (users.count(rnti)) { diff --git a/srsenb/test/common/dummy_classes_common.h b/srsenb/test/common/dummy_classes_common.h index 6bea41f40..783b74701 100644 --- a/srsenb/test/common/dummy_classes_common.h +++ b/srsenb/test/common/dummy_classes_common.h @@ -24,7 +24,7 @@ public: void clear_buffer(uint16_t rnti) override {} void add_user(uint16_t rnti) override {} void rem_user(uint16_t rnti) override {} - void add_bearer(uint16_t rnti, uint32_t lcid, srsran::rlc_config_t cnfg) override {} + void add_bearer(uint16_t rnti, uint32_t lcid, const srsran::rlc_config_t& cnfg) override {} void add_bearer_mrb(uint16_t rnti, uint32_t lcid) override {} void del_bearer(uint16_t rnti, uint32_t lcid) override {} void write_sdu(uint16_t rnti, uint32_t lcid, srsran::unique_byte_buffer_t sdu) override { last_sdu = std::move(sdu); } diff --git a/srsgnb/src/stack/mac/mac_nr.cc b/srsgnb/src/stack/mac/mac_nr.cc index cb3225e85..db3458b96 100644 --- a/srsgnb/src/stack/mac/mac_nr.cc +++ b/srsgnb/src/stack/mac/mac_nr.cc @@ -642,7 +642,7 @@ srsran::byte_buffer_t* mac_nr::assemble_rar(srsran::const_span& buffer, float rx_gain_offset) = 0; + virtual bool measure_rat(const measure_context_t& context, std::vector& buffer, float rx_gain_offset) = 0; /** * @brief Measurement process helper method. Encapsulates the neighbour cell measurement functionality diff --git a/srsue/hdr/phy/scell/intra_measure_lte.h b/srsue/hdr/phy/scell/intra_measure_lte.h index 69fc93cc0..8e8c23eb9 100644 --- a/srsue/hdr/phy/scell/intra_measure_lte.h +++ b/srsue/hdr/phy/scell/intra_measure_lte.h @@ -70,7 +70,7 @@ private: * @param rx_gain_offset Provides last received rx_gain_offset * @return True if no error happens, otherwise false */ - bool measure_rat(measure_context_t context, std::vector& buffer, float rx_gain_offset) override; + bool measure_rat(const measure_context_t& context, std::vector& buffer, float rx_gain_offset) override; srslog::basic_logger& logger; srsran_cell_t serving_cell = {}; ///< Current serving cell in the EARFCN, to avoid reporting it diff --git a/srsue/hdr/phy/scell/intra_measure_nr.h b/srsue/hdr/phy/scell/intra_measure_nr.h index 391483248..a0d3e8218 100644 --- a/srsue/hdr/phy/scell/intra_measure_nr.h +++ b/srsue/hdr/phy/scell/intra_measure_nr.h @@ -109,7 +109,7 @@ private: * @param rx_gain_offset Provides last received rx_gain_offset * @return True if no error happen, otherwise false */ - bool measure_rat(measure_context_t context, std::vector& buffer, float rx_gain_offset) override; + bool measure_rat(const measure_context_t& context, std::vector& buffer, float rx_gain_offset) override; srslog::basic_logger& logger; uint32_t cc_idx = 0; diff --git a/srsue/hdr/stack/rrc_nr/rrc_nr_procedures.h b/srsue/hdr/stack/rrc_nr/rrc_nr_procedures.h index 00ed72c15..50cbb0dbb 100644 --- a/srsue/hdr/stack/rrc_nr/rrc_nr_procedures.h +++ b/srsue/hdr/stack/rrc_nr/rrc_nr_procedures.h @@ -81,9 +81,9 @@ class rrc_nr::connection_setup_proc { public: explicit connection_setup_proc(rrc_nr& parent_); - srsran::proc_outcome_t init(const asn1::rrc_nr::radio_bearer_cfg_s radio_bearer_cfg_, - const asn1::rrc_nr::cell_group_cfg_s cell_group_, - srsran::unique_byte_buffer_t dedicated_info_nas_); + srsran::proc_outcome_t init(const asn1::rrc_nr::radio_bearer_cfg_s& radio_bearer_cfg_, + const asn1::rrc_nr::cell_group_cfg_s& cell_group_, + srsran::unique_byte_buffer_t dedicated_info_nas_); srsran::proc_outcome_t step() { return srsran::proc_outcome_t::yield; } static const char* name() { return "Connection Setup"; } srsran::proc_outcome_t react(const bool& config_complete); diff --git a/srsue/hdr/stack/upper/nas_5g_procedures.h b/srsue/hdr/stack/upper/nas_5g_procedures.h index 742189cf7..a0c048e99 100644 --- a/srsue/hdr/stack/upper/nas_5g_procedures.h +++ b/srsue/hdr/stack/upper/nas_5g_procedures.h @@ -48,7 +48,7 @@ class nas_5g::pdu_session_establishment_procedure { public: explicit pdu_session_establishment_procedure(nas_5g_interface_procedures* parent_nas_, srslog::basic_logger& logger_); - srsran::proc_outcome_t init(const uint16_t pdu_session_id, const pdu_session_cfg_t pdu_session); + srsran::proc_outcome_t init(const uint16_t pdu_session_id, const pdu_session_cfg_t& pdu_session); srsran::proc_outcome_t react(const srsran::nas_5g::pdu_session_establishment_accept_t& pdu_session_est_accept); srsran::proc_outcome_t react(const srsran::nas_5g::pdu_session_establishment_reject_t& pdu_session_est_reject); srsran::proc_outcome_t step(); diff --git a/srsue/src/phy/scell/intra_measure_lte.cc b/srsue/src/phy/scell/intra_measure_lte.cc index b31cda61d..74dd5084a 100644 --- a/srsue/src/phy/scell/intra_measure_lte.cc +++ b/srsue/src/phy/scell/intra_measure_lte.cc @@ -50,7 +50,7 @@ void intra_measure_lte::set_primary_cell(uint32_t earfcn, srsran_cell_t cell) set_current_sf_len((uint32_t)SRSRAN_SF_LEN_PRB(cell.nof_prb)); } -bool intra_measure_lte::measure_rat(measure_context_t context, std::vector& buffer, float rx_gain_offset) +bool intra_measure_lte::measure_rat(const measure_context_t& context, std::vector& buffer, float rx_gain_offset) { std::set cells_to_measure = context.active_pci; diff --git a/srsue/src/phy/scell/intra_measure_nr.cc b/srsue/src/phy/scell/intra_measure_nr.cc index ffe9b7d2c..41ba41ef2 100644 --- a/srsue/src/phy/scell/intra_measure_nr.cc +++ b/srsue/src/phy/scell/intra_measure_nr.cc @@ -81,7 +81,7 @@ bool intra_measure_nr::set_config(const config_t& cfg) return true; } -bool intra_measure_nr::measure_rat(const measure_context_t context, std::vector& buffer, float rx_gain_offset) +bool intra_measure_nr::measure_rat(const measure_context_t& context, std::vector& buffer, float rx_gain_offset) { std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now(); diff --git a/srsue/src/stack/rrc_nr/rrc_nr_procedures.cc b/srsue/src/stack/rrc_nr/rrc_nr_procedures.cc index aabfce7da..c94787359 100644 --- a/srsue/src/stack/rrc_nr/rrc_nr_procedures.cc +++ b/srsue/src/stack/rrc_nr/rrc_nr_procedures.cc @@ -308,9 +308,9 @@ rrc_nr::connection_setup_proc::connection_setup_proc(srsue::rrc_nr& parent_) : 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_, - const asn1::rrc_nr::cell_group_cfg_s cell_group_, - srsran::unique_byte_buffer_t dedicated_info_nas_) +srsran::proc_outcome_t rrc_nr::connection_setup_proc::init(const asn1::rrc_nr::radio_bearer_cfg_s& radio_bearer_cfg_, + const asn1::rrc_nr::cell_group_cfg_s& cell_group_, + srsran::unique_byte_buffer_t dedicated_info_nas_) { Info("Starting..."); diff --git a/srsue/src/stack/upper/nas_5g_procedures.cc b/srsue/src/stack/upper/nas_5g_procedures.cc index 5f92acc6a..6b20e6a07 100644 --- a/srsue/src/stack/upper/nas_5g_procedures.cc +++ b/srsue/src/stack/upper/nas_5g_procedures.cc @@ -42,8 +42,8 @@ nas_5g::pdu_session_establishment_procedure::pdu_session_establishment_procedure logger(logger_), parent_nas(parent_nas_) {} -srsran::proc_outcome_t nas_5g::pdu_session_establishment_procedure::init(const uint16_t pdu_session_id_, - const pdu_session_cfg_t pdu_session_cfg) +srsran::proc_outcome_t nas_5g::pdu_session_establishment_procedure::init(const uint16_t pdu_session_id_, + const pdu_session_cfg_t& pdu_session_cfg) { // Get PDU transaction identity transaction_identity = parent_nas->allocate_next_proc_trans_id();