From 598594c51a6d6754c6120b81e30c93c560f44f81 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Wed, 28 Apr 2021 23:25:38 +0200 Subject: [PATCH] all: bunch of pass by const& changes suggested by LGTM --- lib/include/srsran/interfaces/ue_pdcp_interfaces.h | 4 ++-- lib/include/srsran/interfaces/ue_phy_interfaces.h | 2 +- lib/include/srsran/test/ue_test_interfaces.h | 2 +- lib/include/srsran/upper/pdcp.h | 4 ++-- lib/src/asn1/gtpc.cc | 2 +- lib/src/upper/pdcp.cc | 4 ++-- srsenb/hdr/stack/upper/s1ap.h | 2 +- srsenb/src/stack/upper/s1ap.cc | 2 +- srsepc/hdr/mme/s1ap.h | 2 +- srsepc/hdr/mme/s1ap_mngmt_proc.h | 2 +- srsepc/src/mme/s1ap.cc | 2 +- srsepc/src/mme/s1ap_mngmt_proc.cc | 2 +- srsue/hdr/phy/phy.h | 2 +- srsue/hdr/phy/phy_common.h | 12 ++++++------ srsue/src/phy/phy.cc | 2 +- srsue/src/phy/phy_common.cc | 12 ++++++------ srsue/test/ttcn3/hdr/lte_ttcn3_phy.h | 2 +- srsue/test/ttcn3/src/lte_ttcn3_phy.cc | 2 +- srsue/test/upper/rrc_meas_test.cc | 2 +- 19 files changed, 32 insertions(+), 32 deletions(-) diff --git a/lib/include/srsran/interfaces/ue_pdcp_interfaces.h b/lib/include/srsran/interfaces/ue_pdcp_interfaces.h index 530fcebf2..9c3968da0 100644 --- a/lib/include/srsran/interfaces/ue_pdcp_interfaces.h +++ b/lib/include/srsran/interfaces/ue_pdcp_interfaces.h @@ -28,8 +28,8 @@ public: virtual void add_bearer(uint32_t lcid, srsran::pdcp_config_t cnfg) = 0; virtual void del_bearer(uint32_t lcid) = 0; virtual void change_lcid(uint32_t old_lcid, uint32_t new_lcid) = 0; - virtual void config_security(uint32_t lcid, srsran::as_security_config_t sec_cfg) = 0; - virtual void config_security_all(srsran::as_security_config_t sec_cfg) = 0; + virtual void config_security(uint32_t lcid, const srsran::as_security_config_t& sec_cfg) = 0; + virtual void config_security_all(const srsran::as_security_config_t& sec_cfg) = 0; virtual void enable_integrity(uint32_t lcid, srsran::srsran_direction_t direction) = 0; virtual void enable_encryption(uint32_t lcid, srsran::srsran_direction_t direction = srsran::srsran_direction_t::DIRECTION_TXRX) = 0; diff --git a/lib/include/srsran/interfaces/ue_phy_interfaces.h b/lib/include/srsran/interfaces/ue_phy_interfaces.h index ddebb3564..c86a850da 100644 --- a/lib/include/srsran/interfaces/ue_phy_interfaces.h +++ b/lib/include/srsran/interfaces/ue_phy_interfaces.h @@ -141,7 +141,7 @@ public: class phy_interface_rrc_lte { public: - virtual bool set_config(srsran::phy_cfg_t config, uint32_t cc_idx = 0) = 0; + virtual bool set_config(const srsran::phy_cfg_t& config, uint32_t cc_idx = 0) = 0; virtual bool set_scell(srsran_cell_t cell_info, uint32_t cc_idx, uint32_t earfcn) = 0; virtual void set_config_tdd(srsran_tdd_config_t& tdd_config) = 0; virtual void set_config_mbsfn_sib2(srsran::mbsfn_sf_cfg_t* cfg_list, uint32_t nof_cfgs) = 0; diff --git a/lib/include/srsran/test/ue_test_interfaces.h b/lib/include/srsran/test/ue_test_interfaces.h index 720963b45..e871c8f28 100644 --- a/lib/include/srsran/test/ue_test_interfaces.h +++ b/lib/include/srsran/test/ue_test_interfaces.h @@ -60,7 +60,7 @@ public: class phy_dummy_interface : public phy_interface_rrc_lte { - bool set_config(srsran::phy_cfg_t config, uint32_t cc_idx) override { return true; } + bool set_config(const srsran::phy_cfg_t& config, uint32_t cc_idx) override { return true; } bool set_scell(srsran_cell_t cell_info, uint32_t cc_idx, uint32_t earfcn) override { return true; } void set_config_tdd(srsran_tdd_config_t& tdd_config) override {} void set_config_mbsfn_sib2(srsran::mbsfn_sf_cfg_t* cfg_list, uint32_t nof_cfgs) override {} diff --git a/lib/include/srsran/upper/pdcp.h b/lib/include/srsran/upper/pdcp.h index a3b37c71d..ffa27897c 100644 --- a/lib/include/srsran/upper/pdcp.h +++ b/lib/include/srsran/upper/pdcp.h @@ -46,8 +46,8 @@ public: void add_bearer_mrb(uint32_t lcid, pdcp_config_t cnfg); void del_bearer(uint32_t lcid) override; void change_lcid(uint32_t old_lcid, uint32_t new_lcid) override; - void config_security(uint32_t lcid, as_security_config_t sec_cfg) override; - void config_security_all(as_security_config_t sec_cfg) override; + void config_security(uint32_t lcid, const as_security_config_t& sec_cfg) override; + void config_security_all(const as_security_config_t& sec_cfg) override; void enable_integrity(uint32_t lcid, srsran_direction_t direction) override; void enable_encryption(uint32_t lcid, srsran_direction_t direction) override; void enable_security_timed(uint32_t lcid, srsran_direction_t direction, uint32_t sn); diff --git a/lib/src/asn1/gtpc.cc b/lib/src/asn1/gtpc.cc index a3d114575..7a97f2e64 100644 --- a/lib/src/asn1/gtpc.cc +++ b/lib/src/asn1/gtpc.cc @@ -178,7 +178,7 @@ const char* gtpc_msg_type_to_str(uint8_t type) return "GTPC_MSG_TYPE_INVALID"; } -int gtpc_pack_create_session_request(struct gtpc_create_session_request* cs_req, srsran::byte_buffer_t) +int gtpc_pack_create_session_request(struct gtpc_create_session_request* cs_req, srsran::byte_buffer_t&) { // TODO return 0; diff --git a/lib/src/upper/pdcp.cc b/lib/src/upper/pdcp.cc index 88bc1fa0c..a1a68ae8b 100644 --- a/lib/src/upper/pdcp.cc +++ b/lib/src/upper/pdcp.cc @@ -194,14 +194,14 @@ void pdcp::change_lcid(uint32_t old_lcid, uint32_t new_lcid) } } -void pdcp::config_security(uint32_t lcid, as_security_config_t sec_cfg) +void pdcp::config_security(uint32_t lcid, const as_security_config_t& sec_cfg) { if (valid_lcid(lcid)) { pdcp_array.at(lcid)->config_security(sec_cfg); } } -void pdcp::config_security_all(as_security_config_t sec_cfg) +void pdcp::config_security_all(const as_security_config_t& sec_cfg) { for (auto& it : pdcp_array) { it.second->config_security(sec_cfg); diff --git a/srsenb/hdr/stack/upper/s1ap.h b/srsenb/hdr/stack/upper/s1ap.h index 97d8fddeb..5615a105a 100644 --- a/srsenb/hdr/stack/upper/s1ap.h +++ b/srsenb/hdr/stack/upper/s1ap.h @@ -61,7 +61,7 @@ public: s1ap(srsran::task_sched_handle task_sched_, srslog::basic_logger& logger, srsran::socket_manager_itf* rx_socket_handler); - int init(s1ap_args_t args_, rrc_interface_s1ap* rrc_); + int init(const s1ap_args_t& args_, rrc_interface_s1ap* rrc_); void stop(); void get_metrics(s1ap_metrics_t& m); diff --git a/srsenb/src/stack/upper/s1ap.cc b/srsenb/src/stack/upper/s1ap.cc index a9aef2116..a828911d7 100644 --- a/srsenb/src/stack/upper/s1ap.cc +++ b/srsenb/src/stack/upper/s1ap.cc @@ -289,7 +289,7 @@ s1ap::s1ap(srsran::task_sched_handle task_sched_, mme_task_queue = task_sched.make_task_queue(); } -int s1ap::init(s1ap_args_t args_, rrc_interface_s1ap* rrc_) +int s1ap::init(const s1ap_args_t& args_, rrc_interface_s1ap* rrc_) { rrc = rrc_; args = args_; diff --git a/srsepc/hdr/mme/s1ap.h b/srsepc/hdr/mme/s1ap.h index 2cbd125b3..d07a7eda9 100644 --- a/srsepc/hdr/mme/s1ap.h +++ b/srsepc/hdr/mme/s1ap.h @@ -50,7 +50,7 @@ public: static void cleanup(); int enb_listen(); - int init(s1ap_args_t s1ap_args); + int init(const s1ap_args_t& s1ap_args); void stop(); int get_s1_mme(); diff --git a/srsepc/hdr/mme/s1ap_mngmt_proc.h b/srsepc/hdr/mme/s1ap_mngmt_proc.h index 05d2b3b5a..d4156c093 100644 --- a/srsepc/hdr/mme/s1ap_mngmt_proc.h +++ b/srsepc/hdr/mme/s1ap_mngmt_proc.h @@ -35,7 +35,7 @@ public: // Packing/unpacking helper functions bool unpack_s1_setup_request(const asn1::s1ap::s1_setup_request_s& msg, enb_ctx_t* enb_ctx); bool send_s1_setup_failure(asn1::s1ap::cause_misc_opts::options cause, struct sctp_sndrcvinfo* enb_sri); - bool send_s1_setup_response(s1ap_args_t s1ap_args, struct sctp_sndrcvinfo* enb_sri); + bool send_s1_setup_response(const s1ap_args_t& s1ap_args, struct sctp_sndrcvinfo* enb_sri); private: s1ap_mngmt_proc(); diff --git a/srsepc/src/mme/s1ap.cc b/srsepc/src/mme/s1ap.cc index c6678977e..ef4725e4a 100644 --- a/srsepc/src/mme/s1ap.cc +++ b/srsepc/src/mme/s1ap.cc @@ -49,7 +49,7 @@ void s1ap::cleanup(void) pthread_mutex_unlock(&s1ap_instance_mutex); } -int s1ap::init(s1ap_args_t s1ap_args) +int s1ap::init(const s1ap_args_t& s1ap_args) { m_s1ap_args = s1ap_args; srsran::s1ap_mccmnc_to_plmn(s1ap_args.mcc, s1ap_args.mnc, &m_plmn); diff --git a/srsepc/src/mme/s1ap_mngmt_proc.cc b/srsepc/src/mme/s1ap_mngmt_proc.cc index b0097235c..57f7187b1 100644 --- a/srsepc/src/mme/s1ap_mngmt_proc.cc +++ b/srsepc/src/mme/s1ap_mngmt_proc.cc @@ -182,7 +182,7 @@ bool s1ap_mngmt_proc::send_s1_setup_failure(asn1::s1ap::cause_misc_opts::options return true; } -bool s1ap_mngmt_proc::send_s1_setup_response(s1ap_args_t s1ap_args, struct sctp_sndrcvinfo* enb_sri) +bool s1ap_mngmt_proc::send_s1_setup_response(const s1ap_args_t& s1ap_args, struct sctp_sndrcvinfo* enb_sri) { m_logger.debug("Sending S1 Setup Response"); diff --git a/srsue/hdr/phy/phy.h b/srsue/hdr/phy/phy.h index 127253345..b3a30576b 100644 --- a/srsue/hdr/phy/phy.h +++ b/srsue/hdr/phy/phy.h @@ -107,7 +107,7 @@ public: // Sets the new PHY configuration for the given CC. The configuration is applied in the background. The notify() // function will be called when the reconfiguration is completed. Unless the PRACH configuration has changed, the // reconfiguration will not take more than 3 ms - bool set_config(srsran::phy_cfg_t config, uint32_t cc_idx) final; + bool set_config(const srsran::phy_cfg_t& config, uint32_t cc_idx) final; // Adds or modifies the cell configuration for a given CC. If the EARFCN has changed w.r.t. the previous value, or if // the cell is new, this function might take a few hundred ms to complete, depending on the radio diff --git a/srsue/hdr/phy/phy_common.h b/srsue/hdr/phy/phy_common.h index ef210afa3..2a635912e 100644 --- a/srsue/hdr/phy/phy_common.h +++ b/srsue/hdr/phy/phy_common.h @@ -165,12 +165,12 @@ public: */ uint32_t get_ul_earfcn(uint32_t dl_earfcn); - void update_measurements(uint32_t cc_idx, - srsran_chest_dl_res_t chest_res, - srsran_dl_sf_cfg_t sf_cfg_dl, - float tx_crs_power, - std::vector& serving_cells, - cf_t* rssi_power_buffer = nullptr); + void update_measurements(uint32_t cc_idx, + const srsran_chest_dl_res_t& chest_res, + srsran_dl_sf_cfg_t sf_cfg_dl, + float tx_crs_power, + std::vector& serving_cells, + cf_t* rssi_power_buffer = nullptr); void update_cfo_measurement(uint32_t cc_idx, float cfo_hz); diff --git a/srsue/src/phy/phy.cc b/srsue/src/phy/phy.cc index 2f8302669..694fa6444 100644 --- a/srsue/src/phy/phy.cc +++ b/srsue/src/phy/phy.cc @@ -429,7 +429,7 @@ void phy::enable_pregen_signals(bool enable) } } -bool phy::set_config(srsran::phy_cfg_t config_, uint32_t cc_idx) +bool phy::set_config(const srsran::phy_cfg_t& config_, uint32_t cc_idx) { if (!is_initiated()) { fprintf(stderr, "Error calling set_config(): PHY not initialized\n"); diff --git a/srsue/src/phy/phy_common.cc b/srsue/src/phy/phy_common.cc index 80e2d5985..6e0c350fe 100644 --- a/srsue/src/phy/phy_common.cc +++ b/srsue/src/phy/phy_common.cc @@ -615,12 +615,12 @@ void phy_common::update_cfo_measurement(uint32_t cc_idx, float cfo_hz) avg_cfo_hz[cc_idx] = SRSRAN_VEC_EMA(cfo_hz, avg_cfo_hz[cc_idx], args->snr_ema_coeff); } -void phy_common::update_measurements(uint32_t cc_idx, - srsran_chest_dl_res_t chest_res, - srsran_dl_sf_cfg_t sf_cfg_dl, - float tx_crs_power, - std::vector& serving_cells, - cf_t* rssi_power_buffer) +void phy_common::update_measurements(uint32_t cc_idx, + const srsran_chest_dl_res_t& chest_res, + srsran_dl_sf_cfg_t sf_cfg_dl, + float tx_crs_power, + std::vector& serving_cells, + cf_t* rssi_power_buffer) { bool insync = true; { diff --git a/srsue/test/ttcn3/hdr/lte_ttcn3_phy.h b/srsue/test/ttcn3/hdr/lte_ttcn3_phy.h index c25bb2da0..a1cc99ec7 100644 --- a/srsue/test/ttcn3/hdr/lte_ttcn3_phy.h +++ b/srsue/test/ttcn3/hdr/lte_ttcn3_phy.h @@ -58,7 +58,7 @@ public: void enable_pregen_signals(bool enable) override; void deactivate_scells() override; void set_activation_deactivation_scell(uint32_t cmd, uint32_t tti) override; - bool set_config(srsran::phy_cfg_t config, uint32_t cc_idx = 0) override; + bool set_config(const srsran::phy_cfg_t& config, uint32_t cc_idx = 0) override; bool set_scell(srsran_cell_t cell_info, uint32_t cc_idx, uint32_t earfcn) override; void set_config_tdd(srsran_tdd_config_t& tdd_config) override; void set_config_mbsfn_sib2(srsran::mbsfn_sf_cfg_t* cfg_list, uint32_t nof_cfgs) override{}; diff --git a/srsue/test/ttcn3/src/lte_ttcn3_phy.cc b/srsue/test/ttcn3/src/lte_ttcn3_phy.cc index 8c45a6bcd..d34a75e01 100644 --- a/srsue/test/ttcn3/src/lte_ttcn3_phy.cc +++ b/srsue/test/ttcn3/src/lte_ttcn3_phy.cc @@ -76,7 +76,7 @@ void lte_ttcn3_phy::set_activation_deactivation_scell(uint32_t cmd, uint32_t tti logger.debug("%s not implemented.", __FUNCTION__); } -bool lte_ttcn3_phy::set_config(srsran::phy_cfg_t config, uint32_t cc_idx_) +bool lte_ttcn3_phy::set_config(const srsran::phy_cfg_t& config, uint32_t cc_idx_) { logger.debug("%s not implemented.", __FUNCTION__); task_sched.defer_task([this]() { stack->set_config_complete(true); }); diff --git a/srsue/test/upper/rrc_meas_test.cc b/srsue/test/upper/rrc_meas_test.cc index 3bc02e360..5e2cfce1f 100644 --- a/srsue/test/upper/rrc_meas_test.cc +++ b/srsue/test/upper/rrc_meas_test.cc @@ -34,7 +34,7 @@ public: } // Not implemented methods - bool set_config(srsran::phy_cfg_t config, uint32_t cc_idx) override { return true; } + bool set_config(const srsran::phy_cfg_t& config, uint32_t cc_idx) override { return true; } bool set_scell(srsran_cell_t cell_info, uint32_t cc_idx, uint32_t earfcn) override { return true; } void set_config_tdd(srsran_tdd_config_t& tdd_config) override {} void set_config_mbsfn_sib2(srsran::mbsfn_sf_cfg_t* cfg_list, uint32_t nof_cfgs) override {}