From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8F1044574E; Tue, 6 Aug 2024 17:25:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4CDF440A89; Tue, 6 Aug 2024 17:25:10 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) by mails.dpdk.org (Postfix) with ESMTP id 56B9940A89 for ; Tue, 6 Aug 2024 17:25:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1722957907; x=1754493907; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9M9PZFSwqFlx2QeeHkvPZhn1i66Q+6W5MRaAGUh8Z7c=; b=ZKQpDa0fWyMQgGzZ2PR5xeYlTlOjv5DmFu4MQmLAvGX15IpmQg8xE1zg h4iu63bjeno9LjD010y5YCXHKR+ME2I2UiodkBxM8MNF2uuXixPOUOpOv ckOe6EklPbfCX9dBa5PklcZKj0Y0Xdu+IQtp9hLZ+bkDprKAlWyZh8ChQ YlZl+XCRfIkhVYCyTZRvppxeeCUnLOv0AkYHra148has4+7m7vZiGtdNA w2veqQRTa7HobQrzokFtNLg9JgqZUr9xsOWMnSylSxwWU7PXx9WN9XlVl fAx8ju20jA8qf+JUctBFZ0RV+i2TOD7nuHM4gV1d/SYsX452Br1AHaQ00 g==; X-CSE-ConnectionGUID: EDSCOeqSQqeK60dRPEDC8A== X-CSE-MsgGUID: VN7U/BRAQ+u6ayLGUtvR9w== X-IronPort-AV: E=McAfee;i="6700,10204,11156"; a="21160503" X-IronPort-AV: E=Sophos;i="6.09,268,1716274800"; d="scan'208";a="21160503" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Aug 2024 08:25:06 -0700 X-CSE-ConnectionGUID: 8a01vP1NQ9CizSCm7+Vcvg== X-CSE-MsgGUID: rt9WXD/5Q/OaMwPxb9QHLw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,268,1716274800"; d="scan'208";a="57245495" Received: from silpixa00401385.ir.intel.com ([10.237.214.25]) by orviesa008.jf.intel.com with ESMTP; 06 Aug 2024 08:25:01 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Harman Kalra , Hemant Agrawal , Sachin Saxena , Jie Hai , Yisen Zhuang , Jingjing Wu , Rosen Xu , Liron Himi , Jiawen Wu , Jian Wang , Cristian Dumitrescu , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko Subject: [PATCH 3/4] ethdev: make TM shaper parameters constant Date: Tue, 6 Aug 2024 16:24:16 +0100 Message-ID: <20240806152417.3649745-4-bruce.richardson@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240806152417.3649745-1-bruce.richardson@intel.com> References: <20240806152417.3649745-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The function to add a new shaper profile in rte_tm should not (and does not) modify the profile parameters passed in via struct pointer. We should guarantee this by marking the parameter pointer as const. This allows SW to create multiple profiles using the same parameter struct without having to reset it each time. Signed-off-by: Bruce Richardson --- drivers/net/cnxk/cnxk_tm.c | 2 +- drivers/net/dpaa2/dpaa2_tm.c | 2 +- drivers/net/hns3/hns3_tm.c | 6 +++--- drivers/net/i40e/i40e_tm.c | 6 +++--- drivers/net/iavf/iavf_tm.c | 6 +++--- drivers/net/ice/ice_dcf_sched.c | 6 +++--- drivers/net/ice/ice_tm.c | 6 +++--- drivers/net/ipn3ke/ipn3ke_tm.c | 4 ++-- drivers/net/ixgbe/ixgbe_tm.c | 6 +++--- drivers/net/mvpp2/mrvl_tm.c | 2 +- drivers/net/txgbe/txgbe_tm.c | 6 +++--- lib/ethdev/rte_tm.c | 2 +- lib/ethdev/rte_tm.h | 2 +- lib/ethdev/rte_tm_driver.h | 2 +- 14 files changed, 29 insertions(+), 29 deletions(-) diff --git a/drivers/net/cnxk/cnxk_tm.c b/drivers/net/cnxk/cnxk_tm.c index 9293b3e8f2..0ed6732dda 100644 --- a/drivers/net/cnxk/cnxk_tm.c +++ b/drivers/net/cnxk/cnxk_tm.c @@ -267,7 +267,7 @@ cnxk_nix_tm_node_capa_get(struct rte_eth_dev *eth_dev, uint32_t node_id, static int cnxk_nix_tm_shaper_profile_add(struct rte_eth_dev *eth_dev, uint32_t id, - struct rte_tm_shaper_params *params, + const struct rte_tm_shaper_params *params, struct rte_tm_error *error) { struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev); diff --git a/drivers/net/dpaa2/dpaa2_tm.c b/drivers/net/dpaa2/dpaa2_tm.c index 22337097e5..115397ce47 100644 --- a/drivers/net/dpaa2/dpaa2_tm.c +++ b/drivers/net/dpaa2/dpaa2_tm.c @@ -268,7 +268,7 @@ dpaa2_shaper_profile_from_id(struct dpaa2_dev_priv *priv, static int dpaa2_shaper_profile_add(struct rte_eth_dev *dev, uint32_t shaper_profile_id, - struct rte_tm_shaper_params *params, + const struct rte_tm_shaper_params *params, struct rte_tm_error *error) { struct dpaa2_dev_priv *priv = dev->data->dev_private; diff --git a/drivers/net/hns3/hns3_tm.c b/drivers/net/hns3/hns3_tm.c index 06df32bbcd..1c2ad71133 100644 --- a/drivers/net/hns3/hns3_tm.c +++ b/drivers/net/hns3/hns3_tm.c @@ -166,7 +166,7 @@ hns3_tm_shaper_profile_search(struct rte_eth_dev *dev, static int hns3_tm_shaper_profile_param_check(struct rte_eth_dev *dev, - struct rte_tm_shaper_params *profile, + const struct rte_tm_shaper_params *profile, struct rte_tm_error *error) { struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -220,7 +220,7 @@ hns3_tm_shaper_profile_param_check(struct rte_eth_dev *dev, static int hns3_tm_shaper_profile_add(struct rte_eth_dev *dev, uint32_t shaper_profile_id, - struct rte_tm_shaper_params *profile, + const struct rte_tm_shaper_params *profile, struct rte_tm_error *error) { struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -1198,7 +1198,7 @@ hns3_tm_capabilities_get_wrap(struct rte_eth_dev *dev, static int hns3_tm_shaper_profile_add_wrap(struct rte_eth_dev *dev, uint32_t shaper_profile_id, - struct rte_tm_shaper_params *profile, + const struct rte_tm_shaper_params *profile, struct rte_tm_error *error) { struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); diff --git a/drivers/net/i40e/i40e_tm.c b/drivers/net/i40e/i40e_tm.c index c7d4680fb4..4c0940f355 100644 --- a/drivers/net/i40e/i40e_tm.c +++ b/drivers/net/i40e/i40e_tm.c @@ -12,7 +12,7 @@ static int i40e_tm_capabilities_get(struct rte_eth_dev *dev, struct rte_tm_error *error); static int i40e_shaper_profile_add(struct rte_eth_dev *dev, uint32_t shaper_profile_id, - struct rte_tm_shaper_params *profile, + const struct rte_tm_shaper_params *profile, struct rte_tm_error *error); static int i40e_shaper_profile_del(struct rte_eth_dev *dev, uint32_t shaper_profile_id, @@ -217,7 +217,7 @@ i40e_shaper_profile_search(struct rte_eth_dev *dev, } static int -i40e_shaper_profile_param_check(struct rte_tm_shaper_params *profile, +i40e_shaper_profile_param_check(const struct rte_tm_shaper_params *profile, struct rte_tm_error *error) { /* min rate not supported */ @@ -251,7 +251,7 @@ i40e_shaper_profile_param_check(struct rte_tm_shaper_params *profile, static int i40e_shaper_profile_add(struct rte_eth_dev *dev, uint32_t shaper_profile_id, - struct rte_tm_shaper_params *profile, + const struct rte_tm_shaper_params *profile, struct rte_tm_error *error) { struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); diff --git a/drivers/net/iavf/iavf_tm.c b/drivers/net/iavf/iavf_tm.c index f9883927be..1d12196ba6 100644 --- a/drivers/net/iavf/iavf_tm.c +++ b/drivers/net/iavf/iavf_tm.c @@ -10,7 +10,7 @@ static int iavf_hierarchy_commit(struct rte_eth_dev *dev, __rte_unused struct rte_tm_error *error); static int iavf_shaper_profile_add(struct rte_eth_dev *dev, uint32_t shaper_profile_id, - struct rte_tm_shaper_params *profile, + const struct rte_tm_shaper_params *profile, struct rte_tm_error *error); static int iavf_shaper_profile_del(struct rte_eth_dev *dev, uint32_t shaper_profile_id, @@ -487,7 +487,7 @@ iavf_tm_node_delete(struct rte_eth_dev *dev, uint32_t node_id, } static int -iavf_shaper_profile_param_check(struct rte_tm_shaper_params *profile, +iavf_shaper_profile_param_check(const struct rte_tm_shaper_params *profile, struct rte_tm_error *error) { /* min bucket size not supported */ @@ -515,7 +515,7 @@ iavf_shaper_profile_param_check(struct rte_tm_shaper_params *profile, static int iavf_shaper_profile_add(struct rte_eth_dev *dev, uint32_t shaper_profile_id, - struct rte_tm_shaper_params *profile, + const struct rte_tm_shaper_params *profile, struct rte_tm_error *error) { struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); diff --git a/drivers/net/ice/ice_dcf_sched.c b/drivers/net/ice/ice_dcf_sched.c index b93e001806..7967c35533 100644 --- a/drivers/net/ice/ice_dcf_sched.c +++ b/drivers/net/ice/ice_dcf_sched.c @@ -18,7 +18,7 @@ static int ice_dcf_node_delete(struct rte_eth_dev *dev, uint32_t node_id, struct rte_tm_error *error); static int ice_dcf_shaper_profile_add(struct rte_eth_dev *dev, uint32_t shaper_profile_id, - struct rte_tm_shaper_params *profile, + const struct rte_tm_shaper_params *profile, struct rte_tm_error *error); static int ice_dcf_shaper_profile_del(struct rte_eth_dev *dev, uint32_t shaper_profile_id, @@ -463,7 +463,7 @@ ice_dcf_node_delete(struct rte_eth_dev *dev, uint32_t node_id, } static int -ice_dcf_shaper_profile_param_check(struct rte_tm_shaper_params *profile, +ice_dcf_shaper_profile_param_check(const struct rte_tm_shaper_params *profile, struct rte_tm_error *error) { /* min bucket size not supported */ @@ -491,7 +491,7 @@ ice_dcf_shaper_profile_param_check(struct rte_tm_shaper_params *profile, static int ice_dcf_shaper_profile_add(struct rte_eth_dev *dev, uint32_t shaper_profile_id, - struct rte_tm_shaper_params *profile, + const struct rte_tm_shaper_params *profile, struct rte_tm_error *error) { struct ice_dcf_adapter *adapter = dev->data->dev_private; diff --git a/drivers/net/ice/ice_tm.c b/drivers/net/ice/ice_tm.c index c977e6b177..8a29a9e744 100644 --- a/drivers/net/ice/ice_tm.c +++ b/drivers/net/ice/ice_tm.c @@ -23,7 +23,7 @@ static int ice_node_type_get(struct rte_eth_dev *dev, uint32_t node_id, int *is_leaf, struct rte_tm_error *error); static int ice_shaper_profile_add(struct rte_eth_dev *dev, uint32_t shaper_profile_id, - struct rte_tm_shaper_params *profile, + const struct rte_tm_shaper_params *profile, struct rte_tm_error *error); static int ice_shaper_profile_del(struct rte_eth_dev *dev, uint32_t shaper_profile_id, @@ -237,7 +237,7 @@ ice_shaper_profile_search(struct rte_eth_dev *dev, } static int -ice_shaper_profile_param_check(struct rte_tm_shaper_params *profile, +ice_shaper_profile_param_check(const struct rte_tm_shaper_params *profile, struct rte_tm_error *error) { /* min bucket size not supported */ @@ -265,7 +265,7 @@ ice_shaper_profile_param_check(struct rte_tm_shaper_params *profile, static int ice_shaper_profile_add(struct rte_eth_dev *dev, uint32_t shaper_profile_id, - struct rte_tm_shaper_params *profile, + const struct rte_tm_shaper_params *profile, struct rte_tm_error *error) { struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); diff --git a/drivers/net/ipn3ke/ipn3ke_tm.c b/drivers/net/ipn3ke/ipn3ke_tm.c index 20a0ed0467..eec01bb037 100644 --- a/drivers/net/ipn3ke/ipn3ke_tm.c +++ b/drivers/net/ipn3ke/ipn3ke_tm.c @@ -722,7 +722,7 @@ ipn3ke_tm_node_capabilities_get(struct rte_eth_dev *dev, } static int -ipn3ke_tm_shaper_parame_trans(struct rte_tm_shaper_params *profile, +ipn3ke_tm_shaper_parame_trans(const struct rte_tm_shaper_params *profile, struct ipn3ke_tm_shaper_profile *local_profile, const struct ipn3ke_tm_shaper_params_range_type *ref_data) { @@ -747,7 +747,7 @@ ipn3ke_tm_shaper_parame_trans(struct rte_tm_shaper_params *profile, static int ipn3ke_tm_shaper_profile_add(struct rte_eth_dev *dev, - uint32_t shaper_profile_id, struct rte_tm_shaper_params *profile, + uint32_t shaper_profile_id, const struct rte_tm_shaper_params *profile, struct rte_tm_error *error) { struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(dev); diff --git a/drivers/net/ixgbe/ixgbe_tm.c b/drivers/net/ixgbe/ixgbe_tm.c index 75cd707109..27a821285d 100644 --- a/drivers/net/ixgbe/ixgbe_tm.c +++ b/drivers/net/ixgbe/ixgbe_tm.c @@ -11,7 +11,7 @@ static int ixgbe_tm_capabilities_get(struct rte_eth_dev *dev, struct rte_tm_error *error); static int ixgbe_shaper_profile_add(struct rte_eth_dev *dev, uint32_t shaper_profile_id, - struct rte_tm_shaper_params *profile, + const struct rte_tm_shaper_params *profile, struct rte_tm_error *error); static int ixgbe_shaper_profile_del(struct rte_eth_dev *dev, uint32_t shaper_profile_id, @@ -226,7 +226,7 @@ ixgbe_shaper_profile_search(struct rte_eth_dev *dev, } static int -ixgbe_shaper_profile_param_check(struct rte_tm_shaper_params *profile, +ixgbe_shaper_profile_param_check(const struct rte_tm_shaper_params *profile, struct rte_tm_error *error) { /* min rate not supported */ @@ -260,7 +260,7 @@ ixgbe_shaper_profile_param_check(struct rte_tm_shaper_params *profile, static int ixgbe_shaper_profile_add(struct rte_eth_dev *dev, uint32_t shaper_profile_id, - struct rte_tm_shaper_params *profile, + const struct rte_tm_shaper_params *profile, struct rte_tm_error *error) { struct ixgbe_tm_conf *tm_conf = diff --git a/drivers/net/mvpp2/mrvl_tm.c b/drivers/net/mvpp2/mrvl_tm.c index 9fac80b867..3c7cf481a5 100644 --- a/drivers/net/mvpp2/mrvl_tm.c +++ b/drivers/net/mvpp2/mrvl_tm.c @@ -380,7 +380,7 @@ mrvl_shaper_profile_from_id(struct mrvl_priv *priv, uint32_t shaper_profile_id) */ static int mrvl_shaper_profile_add(struct rte_eth_dev *dev, uint32_t shaper_profile_id, - struct rte_tm_shaper_params *params, + const struct rte_tm_shaper_params *params, struct rte_tm_error *error) { struct mrvl_priv *priv = dev->data->dev_private; diff --git a/drivers/net/txgbe/txgbe_tm.c b/drivers/net/txgbe/txgbe_tm.c index 8ed4d24459..b62bcf54aa 100644 --- a/drivers/net/txgbe/txgbe_tm.c +++ b/drivers/net/txgbe/txgbe_tm.c @@ -12,7 +12,7 @@ static int txgbe_tm_capabilities_get(struct rte_eth_dev *dev, struct rte_tm_error *error); static int txgbe_shaper_profile_add(struct rte_eth_dev *dev, uint32_t shaper_profile_id, - struct rte_tm_shaper_params *profile, + const struct rte_tm_shaper_params *profile, struct rte_tm_error *error); static int txgbe_shaper_profile_del(struct rte_eth_dev *dev, uint32_t shaper_profile_id, @@ -218,7 +218,7 @@ txgbe_shaper_profile_search(struct rte_eth_dev *dev, } static int -txgbe_shaper_profile_param_check(struct rte_tm_shaper_params *profile, +txgbe_shaper_profile_param_check(const struct rte_tm_shaper_params *profile, struct rte_tm_error *error) { /* min rate not supported */ @@ -252,7 +252,7 @@ txgbe_shaper_profile_param_check(struct rte_tm_shaper_params *profile, static int txgbe_shaper_profile_add(struct rte_eth_dev *dev, uint32_t shaper_profile_id, - struct rte_tm_shaper_params *profile, + const struct rte_tm_shaper_params *profile, struct rte_tm_error *error) { struct txgbe_tm_conf *tm_conf = TXGBE_DEV_TM_CONF(dev); diff --git a/lib/ethdev/rte_tm.c b/lib/ethdev/rte_tm.c index d221b1e553..3eb98e618a 100644 --- a/lib/ethdev/rte_tm.c +++ b/lib/ethdev/rte_tm.c @@ -218,7 +218,7 @@ int rte_tm_shared_wred_context_delete(uint16_t port_id, /* Add shaper profile */ int rte_tm_shaper_profile_add(uint16_t port_id, uint32_t shaper_profile_id, - struct rte_tm_shaper_params *profile, + const struct rte_tm_shaper_params *profile, struct rte_tm_error *error) { struct rte_eth_dev *dev = &rte_eth_devices[port_id]; diff --git a/lib/ethdev/rte_tm.h b/lib/ethdev/rte_tm.h index f6f3f6a8d4..e5da9b8323 100644 --- a/lib/ethdev/rte_tm.h +++ b/lib/ethdev/rte_tm.h @@ -1449,7 +1449,7 @@ rte_tm_shared_wred_context_delete(uint16_t port_id, int rte_tm_shaper_profile_add(uint16_t port_id, uint32_t shaper_profile_id, - struct rte_tm_shaper_params *profile, + const struct rte_tm_shaper_params *profile, struct rte_tm_error *error); /** diff --git a/lib/ethdev/rte_tm_driver.h b/lib/ethdev/rte_tm_driver.h index b6ecf1bd4d..6c2618c0d8 100644 --- a/lib/ethdev/rte_tm_driver.h +++ b/lib/ethdev/rte_tm_driver.h @@ -75,7 +75,7 @@ typedef int (*rte_tm_shared_wred_context_delete_t)( /** @internal Traffic manager shaper profile add */ typedef int (*rte_tm_shaper_profile_add_t)(struct rte_eth_dev *dev, uint32_t shaper_profile_id, - struct rte_tm_shaper_params *profile, + const struct rte_tm_shaper_params *profile, struct rte_tm_error *error); /** @internal Traffic manager shaper profile delete */ -- 2.43.0