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 D00E74574E; Tue, 6 Aug 2024 17:24:58 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C29B540B92; Tue, 6 Aug 2024 17:24:58 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) by mails.dpdk.org (Postfix) with ESMTP id 5420D40A89 for ; Tue, 6 Aug 2024 17:24:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1722957896; x=1754493896; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RuJG/USwKQlK70Po47ARxGx7tHv333x6CtPj0+H5/y0=; b=PM0M9DDH0Fuice4DdHzrq/ZBSH5tlm2J685rQ4+rB3SDl19CLiV9DVwz 0QOT7ocLlm8ydbqbcY8hMqZpPfcQDJ9mvzQ/PJSua97PW8RKAN7mG+/Eb jGyLza5cmZFp1G4Wa09qrdKWL1lZkq7kNCgW43BrDYU/2FfEHWCMUTPTA 82Bz9C4on2M7DZ9SfYedygJHbaSwMk+ah0+9gA9NVCGPEJXYDwSR43bML 417zGFNSESq+RK9pvm9IqYo2TUep8Jcah3cRZsP3/x0xm3DM8h36velhx tdHR/WQKGt8Zzy0OeG/iMIFsU42Uw4A4+oo2x2xzAYs13pNYsFByPIaC1 A==; X-CSE-ConnectionGUID: tOYNnSCXSJe47sY/uicQBA== X-CSE-MsgGUID: wUjiDDbtT3OaLj2KS5Sdtw== X-IronPort-AV: E=McAfee;i="6700,10204,11156"; a="21160476" X-IronPort-AV: E=Sophos;i="6.09,268,1716274800"; d="scan'208";a="21160476" 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:24:55 -0700 X-CSE-ConnectionGUID: FJwiU2jmRz+32CPnz+Iyhg== X-CSE-MsgGUID: kaUlblYiTcuODup+oNxoWw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,268,1716274800"; d="scan'208";a="57245400" Received: from silpixa00401385.ir.intel.com ([10.237.214.25]) by orviesa008.jf.intel.com with ESMTP; 06 Aug 2024 08:24:50 -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 , Jiawen Wu , Jian Wang , Cristian Dumitrescu , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko Subject: [PATCH 1/4] ethdev: make parameters to TM node add fn constant Date: Tue, 6 Aug 2024 16:24:14 +0100 Message-ID: <20240806152417.3649745-2-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 scheduling node in rte_tm should not (and does not) modify the actual node parameters passed in via struct pointer. We should guarantee this by marking the parameter pointer as const. This allows SW to create multiple scheduling nodes 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 | 4 ++-- drivers/net/hns3/hns3_tm.c | 16 ++++++++-------- 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/txgbe/txgbe_tm.c | 6 +++--- lib/ethdev/rte_tm.c | 2 +- lib/ethdev/rte_tm.h | 2 +- lib/ethdev/rte_tm_driver.h | 2 +- 13 files changed, 34 insertions(+), 34 deletions(-) diff --git a/drivers/net/cnxk/cnxk_tm.c b/drivers/net/cnxk/cnxk_tm.c index c799193cb8..9293b3e8f2 100644 --- a/drivers/net/cnxk/cnxk_tm.c +++ b/drivers/net/cnxk/cnxk_tm.c @@ -336,7 +336,7 @@ static int cnxk_nix_tm_node_add(struct rte_eth_dev *eth_dev, uint32_t node_id, uint32_t parent_node_id, uint32_t priority, uint32_t weight, uint32_t lvl, - struct rte_tm_node_params *params, + const struct rte_tm_node_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 cb854964b4..22337097e5 100644 --- a/drivers/net/dpaa2/dpaa2_tm.c +++ b/drivers/net/dpaa2/dpaa2_tm.c @@ -359,7 +359,7 @@ static int dpaa2_node_check_params(struct rte_eth_dev *dev, uint32_t node_id, __rte_unused uint32_t priority, uint32_t weight, uint32_t level_id, - struct rte_tm_node_params *params, + const struct rte_tm_node_params *params, struct rte_tm_error *error) { if (node_id == RTE_TM_NODE_ID_NULL) @@ -431,7 +431,7 @@ dpaa2_node_check_params(struct rte_eth_dev *dev, uint32_t node_id, static int dpaa2_node_add(struct rte_eth_dev *dev, uint32_t node_id, uint32_t parent_node_id, uint32_t priority, uint32_t weight, - uint32_t level_id, struct rte_tm_node_params *params, + uint32_t level_id, const struct rte_tm_node_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 92a668538f..06df32bbcd 100644 --- a/drivers/net/hns3/hns3_tm.c +++ b/drivers/net/hns3/hns3_tm.c @@ -329,7 +329,7 @@ hns3_tm_node_search(struct rte_eth_dev *dev, static int hns3_tm_nonleaf_node_param_check(struct rte_eth_dev *dev, - struct rte_tm_node_params *params, + const struct rte_tm_node_params *params, struct rte_tm_error *error) { struct hns3_tm_shaper_profile *shaper_profile; @@ -364,7 +364,7 @@ hns3_tm_nonleaf_node_param_check(struct rte_eth_dev *dev, static int hns3_tm_leaf_node_param_check(struct rte_eth_dev *dev __rte_unused, - struct rte_tm_node_params *params, + const struct rte_tm_node_params *params, struct rte_tm_error *error) { @@ -408,7 +408,7 @@ hns3_tm_leaf_node_param_check(struct rte_eth_dev *dev __rte_unused, static int hns3_tm_node_param_check(struct rte_eth_dev *dev, uint32_t node_id, uint32_t priority, uint32_t weight, - struct rte_tm_node_params *params, + const struct rte_tm_node_params *params, struct rte_tm_error *error) { struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -457,7 +457,7 @@ hns3_tm_node_param_check(struct rte_eth_dev *dev, uint32_t node_id, static int hns3_tm_port_node_add(struct rte_eth_dev *dev, uint32_t node_id, - uint32_t level_id, struct rte_tm_node_params *params, + uint32_t level_id, const struct rte_tm_node_params *params, struct rte_tm_error *error) { struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -503,7 +503,7 @@ hns3_tm_port_node_add(struct rte_eth_dev *dev, uint32_t node_id, static int hns3_tm_tc_node_add(struct rte_eth_dev *dev, uint32_t node_id, uint32_t level_id, struct hns3_tm_node *parent_node, - struct rte_tm_node_params *params, + const struct rte_tm_node_params *params, struct rte_tm_error *error) { struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -554,7 +554,7 @@ hns3_tm_tc_node_add(struct rte_eth_dev *dev, uint32_t node_id, static int hns3_tm_queue_node_add(struct rte_eth_dev *dev, uint32_t node_id, uint32_t level_id, struct hns3_tm_node *parent_node, - struct rte_tm_node_params *params, + const struct rte_tm_node_params *params, struct rte_tm_error *error) { struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -601,7 +601,7 @@ static int hns3_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id, uint32_t parent_node_id, uint32_t priority, uint32_t weight, uint32_t level_id, - struct rte_tm_node_params *params, + const struct rte_tm_node_params *params, struct rte_tm_error *error) { struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -1230,7 +1230,7 @@ static int hns3_tm_node_add_wrap(struct rte_eth_dev *dev, uint32_t node_id, uint32_t parent_node_id, uint32_t priority, uint32_t weight, uint32_t level_id, - struct rte_tm_node_params *params, + const struct rte_tm_node_params *params, 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 cab296e1a4..c7d4680fb4 100644 --- a/drivers/net/i40e/i40e_tm.c +++ b/drivers/net/i40e/i40e_tm.c @@ -20,7 +20,7 @@ static int i40e_shaper_profile_del(struct rte_eth_dev *dev, static int i40e_node_add(struct rte_eth_dev *dev, uint32_t node_id, uint32_t parent_node_id, uint32_t priority, uint32_t weight, uint32_t level_id, - struct rte_tm_node_params *params, + const struct rte_tm_node_params *params, struct rte_tm_error *error); static int i40e_node_delete(struct rte_eth_dev *dev, uint32_t node_id, struct rte_tm_error *error); @@ -353,7 +353,7 @@ i40e_tm_node_search(struct rte_eth_dev *dev, static int i40e_node_param_check(struct rte_eth_dev *dev, uint32_t node_id, uint32_t priority, uint32_t weight, - struct rte_tm_node_params *params, + const struct rte_tm_node_params *params, struct rte_tm_error *error) { struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -450,7 +450,7 @@ static int i40e_node_add(struct rte_eth_dev *dev, uint32_t node_id, uint32_t parent_node_id, uint32_t priority, uint32_t weight, uint32_t level_id, - struct rte_tm_node_params *params, + const struct rte_tm_node_params *params, struct rte_tm_error *error) { struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); diff --git a/drivers/net/iavf/iavf_tm.c b/drivers/net/iavf/iavf_tm.c index 32bb3be45e..f9883927be 100644 --- a/drivers/net/iavf/iavf_tm.c +++ b/drivers/net/iavf/iavf_tm.c @@ -18,7 +18,7 @@ static int iavf_shaper_profile_del(struct rte_eth_dev *dev, static int iavf_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id, uint32_t parent_node_id, uint32_t priority, uint32_t weight, uint32_t level_id, - struct rte_tm_node_params *params, + const struct rte_tm_node_params *params, struct rte_tm_error *error); static int iavf_tm_node_delete(struct rte_eth_dev *dev, uint32_t node_id, struct rte_tm_error *error); @@ -131,7 +131,7 @@ iavf_tm_node_search(struct rte_eth_dev *dev, static int iavf_node_param_check(struct iavf_info *vf, uint32_t node_id, uint32_t priority, uint32_t weight, - struct rte_tm_node_params *params, + const struct rte_tm_node_params *params, struct rte_tm_error *error) { /* checked all the unsupported parameter */ @@ -271,7 +271,7 @@ static int iavf_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id, uint32_t parent_node_id, uint32_t priority, uint32_t weight, uint32_t level_id, - struct rte_tm_node_params *params, + const struct rte_tm_node_params *params, 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 b08bc5f1de..b93e001806 100644 --- a/drivers/net/ice/ice_dcf_sched.c +++ b/drivers/net/ice/ice_dcf_sched.c @@ -12,7 +12,7 @@ static int ice_dcf_hierarchy_commit(struct rte_eth_dev *dev, static int ice_dcf_node_add(struct rte_eth_dev *dev, uint32_t node_id, uint32_t parent_node_id, uint32_t priority, uint32_t weight, uint32_t level_id, - struct rte_tm_node_params *params, + const struct rte_tm_node_params *params, struct rte_tm_error *error); static int ice_dcf_node_delete(struct rte_eth_dev *dev, uint32_t node_id, struct rte_tm_error *error); @@ -139,7 +139,7 @@ ice_dcf_shaper_profile_search(struct rte_eth_dev *dev, static int ice_dcf_node_param_check(struct ice_dcf_hw *hw, uint32_t node_id, uint32_t priority, uint32_t weight, - struct rte_tm_node_params *params, + const struct rte_tm_node_params *params, struct rte_tm_error *error) { /* checked all the unsupported parameter */ @@ -230,7 +230,7 @@ static int ice_dcf_node_add(struct rte_eth_dev *dev, uint32_t node_id, uint32_t parent_node_id, uint32_t priority, uint32_t weight, uint32_t level_id, - struct rte_tm_node_params *params, + const struct rte_tm_node_params *params, struct rte_tm_error *error) { enum ice_dcf_tm_node_type parent_node_type = ICE_DCF_TM_NODE_TYPE_MAX; diff --git a/drivers/net/ice/ice_tm.c b/drivers/net/ice/ice_tm.c index 7239ab53f1..c977e6b177 100644 --- a/drivers/net/ice/ice_tm.c +++ b/drivers/net/ice/ice_tm.c @@ -15,7 +15,7 @@ static int ice_hierarchy_commit(struct rte_eth_dev *dev, static int ice_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id, uint32_t parent_node_id, uint32_t priority, uint32_t weight, uint32_t level_id, - struct rte_tm_node_params *params, + const struct rte_tm_node_params *params, struct rte_tm_error *error); static int ice_tm_node_delete(struct rte_eth_dev *dev, uint32_t node_id, struct rte_tm_error *error); @@ -82,7 +82,7 @@ ice_tm_conf_uninit(struct rte_eth_dev *dev) static int ice_node_param_check(struct ice_pf *pf, uint32_t node_id, uint32_t priority, uint32_t weight, - struct rte_tm_node_params *params, + const struct rte_tm_node_params *params, struct rte_tm_error *error) { /* checked all the unsupported parameter */ @@ -337,7 +337,7 @@ static int ice_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id, uint32_t parent_node_id, uint32_t priority, uint32_t weight, uint32_t level_id, - struct rte_tm_node_params *params, + const struct rte_tm_node_params *params, 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 0260227900..cffe1fdaa4 100644 --- a/drivers/net/ipn3ke/ipn3ke_tm.c +++ b/drivers/net/ipn3ke/ipn3ke_tm.c @@ -1010,7 +1010,7 @@ ipn3ke_tm_tdrop_profile_delete(struct rte_eth_dev *dev, static int ipn3ke_tm_node_add_check_parameter(uint32_t tm_id, uint32_t node_id, uint32_t parent_node_id, uint32_t priority, - uint32_t weight, uint32_t level_id, struct rte_tm_node_params *params, + uint32_t weight, uint32_t level_id, const struct rte_tm_node_params *params, struct rte_tm_error *error) { uint32_t level_of_node_id; @@ -1168,7 +1168,7 @@ ipn3ke_tm_node_add_check_mount(uint32_t tm_id, static int ipn3ke_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id, uint32_t parent_node_id, uint32_t priority, - uint32_t weight, uint32_t level_id, struct rte_tm_node_params *params, + uint32_t weight, uint32_t level_id, const struct rte_tm_node_params *params, 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 ac8976062f..75cd707109 100644 --- a/drivers/net/ixgbe/ixgbe_tm.c +++ b/drivers/net/ixgbe/ixgbe_tm.c @@ -19,7 +19,7 @@ static int ixgbe_shaper_profile_del(struct rte_eth_dev *dev, static int ixgbe_node_add(struct rte_eth_dev *dev, uint32_t node_id, uint32_t parent_node_id, uint32_t priority, uint32_t weight, uint32_t level_id, - struct rte_tm_node_params *params, + const struct rte_tm_node_params *params, struct rte_tm_error *error); static int ixgbe_node_delete(struct rte_eth_dev *dev, uint32_t node_id, struct rte_tm_error *error); @@ -461,7 +461,7 @@ ixgbe_queue_base_nb_get(struct rte_eth_dev *dev, uint16_t tc_node_no, static int ixgbe_node_param_check(struct rte_eth_dev *dev, uint32_t node_id, uint32_t priority, uint32_t weight, - struct rte_tm_node_params *params, + const struct rte_tm_node_params *params, struct rte_tm_error *error) { if (node_id == RTE_TM_NODE_ID_NULL) { @@ -558,7 +558,7 @@ static int ixgbe_node_add(struct rte_eth_dev *dev, uint32_t node_id, uint32_t parent_node_id, uint32_t priority, uint32_t weight, uint32_t level_id, - struct rte_tm_node_params *params, + const struct rte_tm_node_params *params, struct rte_tm_error *error) { struct ixgbe_tm_conf *tm_conf = diff --git a/drivers/net/txgbe/txgbe_tm.c b/drivers/net/txgbe/txgbe_tm.c index 3171be73d0..8ed4d24459 100644 --- a/drivers/net/txgbe/txgbe_tm.c +++ b/drivers/net/txgbe/txgbe_tm.c @@ -20,7 +20,7 @@ static int txgbe_shaper_profile_del(struct rte_eth_dev *dev, static int txgbe_node_add(struct rte_eth_dev *dev, uint32_t node_id, uint32_t parent_node_id, uint32_t priority, uint32_t weight, uint32_t level_id, - struct rte_tm_node_params *params, + const struct rte_tm_node_params *params, struct rte_tm_error *error); static int txgbe_node_delete(struct rte_eth_dev *dev, uint32_t node_id, struct rte_tm_error *error); @@ -450,7 +450,7 @@ txgbe_queue_base_nb_get(struct rte_eth_dev *dev, uint16_t tc_node_no, static int txgbe_node_param_check(struct rte_eth_dev *dev, uint32_t node_id, uint32_t priority, uint32_t weight, - struct rte_tm_node_params *params, + const struct rte_tm_node_params *params, struct rte_tm_error *error) { if (node_id == RTE_TM_NODE_ID_NULL) { @@ -547,7 +547,7 @@ static int txgbe_node_add(struct rte_eth_dev *dev, uint32_t node_id, uint32_t parent_node_id, uint32_t priority, uint32_t weight, uint32_t level_id, - struct rte_tm_node_params *params, + const struct rte_tm_node_params *params, 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 d594fe0049..74e6f4d610 100644 --- a/lib/ethdev/rte_tm.c +++ b/lib/ethdev/rte_tm.c @@ -286,7 +286,7 @@ int rte_tm_node_add(uint16_t port_id, uint32_t priority, uint32_t weight, uint32_t level_id, - struct rte_tm_node_params *params, + const struct rte_tm_node_params *params, 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 07028c9b36..c52acd1b4f 100644 --- a/lib/ethdev/rte_tm.h +++ b/lib/ethdev/rte_tm.h @@ -1596,7 +1596,7 @@ rte_tm_node_add(uint16_t port_id, uint32_t priority, uint32_t weight, uint32_t level_id, - struct rte_tm_node_params *params, + const struct rte_tm_node_params *params, struct rte_tm_error *error); /** diff --git a/lib/ethdev/rte_tm_driver.h b/lib/ethdev/rte_tm_driver.h index 45290fb3fd..25d688516b 100644 --- a/lib/ethdev/rte_tm_driver.h +++ b/lib/ethdev/rte_tm_driver.h @@ -101,7 +101,7 @@ typedef int (*rte_tm_node_add_t)(struct rte_eth_dev *dev, uint32_t priority, uint32_t weight, uint32_t level_id, - struct rte_tm_node_params *params, + const struct rte_tm_node_params *params, struct rte_tm_error *error); /** @internal Traffic manager node delete */ -- 2.43.0