From patchwork Tue Aug 6 15:24:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 142964 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org 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 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 Reviewed-by: Rosen Xu Acked-by: Ferruh Yigit --- 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 */ From patchwork Tue Aug 6 15:24:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 142965 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 315684574E; Tue, 6 Aug 2024 17:25:03 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D85AC40DD1; Tue, 6 Aug 2024 17:25:01 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) by mails.dpdk.org (Postfix) with ESMTP id E0C7340DC9 for ; Tue, 6 Aug 2024 17:24:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1722957900; x=1754493900; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dM4N6f3Q73DqMhROK0ar0Gk5Bd8dw+WEsWa/YZJ1Y78=; b=Z+ZeaVgCSQS1N3OHJ7VHBpnRTJkqv1HomDtrRIQw0ssKLjQxpoQXdx0E R3WFAM7Wls8nm8/l094QSBoTK9iduX2jZUOz3og1oZu+gS0TSyNBxemnU bDtwZ6oFIRdQCRkvZvURCZ+Ex1M5+EEraU5J1IOdYy1o1hByZZPwQToZ2 a1IN4H7Cug6J2Lr2vv/0CZJ4Mq/1K5PowClk2gUPeFwCYRr6Cl3B+HrNP g8tJqCDIfiBTDBqQop5z5ECZS9YLqWxanHpCMWJgPbM0beh/MYoa3+rKY cU4tB71QXbP53Zkd9ZsGeyoiziyuzvvQ9bDVkA7Isf/hnyRwgM4yoXhsg A==; X-CSE-ConnectionGUID: b8JpWk7oQVu52ARAdKjBrg== X-CSE-MsgGUID: avrEyC/CQE2a/uWxuj1GFg== X-IronPort-AV: E=McAfee;i="6700,10204,11156"; a="21160486" X-IronPort-AV: E=Sophos;i="6.09,268,1716274800"; d="scan'208";a="21160486" 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:59 -0700 X-CSE-ConnectionGUID: I8PZ6aAwRp6ejTEOeMUyOA== X-CSE-MsgGUID: eetFJE6UTXGTnItNT6753Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,268,1716274800"; d="scan'208";a="57245435" Received: from silpixa00401385.ir.intel.com ([10.237.214.25]) by orviesa008.jf.intel.com with ESMTP; 06 Aug 2024 08:24:57 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , Rosen Xu , Cristian Dumitrescu , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko Subject: [PATCH 2/4] ethdev: make parameters to TM profile add fn constant Date: Tue, 6 Aug 2024 16:24:15 +0100 Message-ID: <20240806152417.3649745-3-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 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 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 Reviewed-by: Rosen Xu Acked-by: Ferruh Yigit --- drivers/net/ipn3ke/ipn3ke_tm.c | 4 ++-- lib/ethdev/rte_tm.c | 2 +- lib/ethdev/rte_tm.h | 2 +- lib/ethdev/rte_tm_driver.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) -- 2.43.0 diff --git a/drivers/net/ipn3ke/ipn3ke_tm.c b/drivers/net/ipn3ke/ipn3ke_tm.c index cffe1fdaa4..20a0ed0467 100644 --- a/drivers/net/ipn3ke/ipn3ke_tm.c +++ b/drivers/net/ipn3ke/ipn3ke_tm.c @@ -848,7 +848,7 @@ ipn3ke_tm_shaper_profile_delete(struct rte_eth_dev *dev, static int ipn3ke_tm_tdrop_profile_check(__rte_unused struct rte_eth_dev *dev, - uint32_t tdrop_profile_id, struct rte_tm_wred_params *profile, + uint32_t tdrop_profile_id, const struct rte_tm_wred_params *profile, struct rte_tm_error *error) { enum rte_color color; @@ -931,7 +931,7 @@ ipn3ke_hw_tm_tdrop_wr(struct ipn3ke_hw *hw, /* Traffic manager TDROP profile add */ static int ipn3ke_tm_tdrop_profile_add(struct rte_eth_dev *dev, - uint32_t tdrop_profile_id, struct rte_tm_wred_params *profile, + uint32_t tdrop_profile_id, const struct rte_tm_wred_params *profile, struct rte_tm_error *error) { struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(dev); diff --git a/lib/ethdev/rte_tm.c b/lib/ethdev/rte_tm.c index 74e6f4d610..d221b1e553 100644 --- a/lib/ethdev/rte_tm.c +++ b/lib/ethdev/rte_tm.c @@ -153,7 +153,7 @@ int rte_tm_node_capabilities_get(uint16_t port_id, /* Add WRED profile */ int rte_tm_wred_profile_add(uint16_t port_id, uint32_t wred_profile_id, - struct rte_tm_wred_params *profile, + const struct rte_tm_wred_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 c52acd1b4f..f6f3f6a8d4 100644 --- a/lib/ethdev/rte_tm.h +++ b/lib/ethdev/rte_tm.h @@ -1347,7 +1347,7 @@ rte_tm_node_capabilities_get(uint16_t port_id, int rte_tm_wred_profile_add(uint16_t port_id, uint32_t wred_profile_id, - struct rte_tm_wred_params *profile, + const struct rte_tm_wred_params *profile, struct rte_tm_error *error); /** diff --git a/lib/ethdev/rte_tm_driver.h b/lib/ethdev/rte_tm_driver.h index 25d688516b..b6ecf1bd4d 100644 --- a/lib/ethdev/rte_tm_driver.h +++ b/lib/ethdev/rte_tm_driver.h @@ -51,7 +51,7 @@ typedef int (*rte_tm_node_capabilities_get_t)(struct rte_eth_dev *dev, /** @internal Traffic manager WRED profile add */ typedef int (*rte_tm_wred_profile_add_t)(struct rte_eth_dev *dev, uint32_t wred_profile_id, - struct rte_tm_wred_params *profile, + const struct rte_tm_wred_params *profile, struct rte_tm_error *error); /** @internal Traffic manager WRED profile delete */ From patchwork Tue Aug 6 15:24:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 142966 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org 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 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 Reviewed-by: Rosen Xu Acked-by: Ferruh Yigit --- 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(-) -- 2.43.0 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 */ From patchwork Tue Aug 6 15:24:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 142967 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C02D24574E; Tue, 6 Aug 2024 17:25:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E992A40E43; Tue, 6 Aug 2024 17:25:13 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) by mails.dpdk.org (Postfix) with ESMTP id A168540E43 for ; Tue, 6 Aug 2024 17:25:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1722957912; x=1754493912; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7flcBQs/VJM0iJc3WGvVe9KsR5jD9Jmdt9YDD5n9rA0=; b=LG4ljGx+DP1TBtS5w1igkjEcoZ6MLgl+t6Pmv/61hU7ArfnbzpyIPsb7 xoPRkbMX4t+t+qB/zSOvxynELLonGJQWEm2U06ZkRkKqDNBy3mzn6ou36 f1ALtOOtUXw0cKpKwF6f062FTMnamX1TtpKXVOyK4Q051GBn9eON+IXx3 ZZMBde7gZC/4jHc9V8izEpMxcn/+ejLYAIEvgULPXox+hn44G9RuDQIeq x2l9hRhGXmV48IgR9US1FUQ7HekyumBMubyqVlyVU17j9a0knwzPUyYsZ +5OMNyRzlGHP/BO0VSJnrf/rN6p3/zoAMx+ZYk17bguoOPSPw9Ez+Kafv A==; X-CSE-ConnectionGUID: aZZ4C8mBQZ+N5cL0FnTjgg== X-CSE-MsgGUID: rm7ltbVfTc+a0JN7CfPawg== X-IronPort-AV: E=McAfee;i="6700,10204,11156"; a="21160527" X-IronPort-AV: E=Sophos;i="6.09,268,1716274800"; d="scan'208";a="21160527" 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:11 -0700 X-CSE-ConnectionGUID: 7WXpZDvZS+6OAsF+yYuc6w== X-CSE-MsgGUID: RasTD5Z9RU690TOqLBcbOA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,268,1716274800"; d="scan'208";a="57245522" Received: from silpixa00401385.ir.intel.com ([10.237.214.25]) by orviesa008.jf.intel.com with ESMTP; 06 Aug 2024 08:25:09 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko , Cristian Dumitrescu Subject: [PATCH 4/4] ethdev: add traffic manager query function Date: Tue, 6 Aug 2024 16:24:17 +0100 Message-ID: <20240806152417.3649745-5-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 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 Add function to allow querying a node in the scheduler tree. Returns the parameters as were given to the add function. Adding this function allows apps to just query the hierarchy rather than having to maintain their own copies of it internally. Signed-off-by: Bruce Richardson --- lib/ethdev/ethdev_trace.h | 16 +++++++++++ lib/ethdev/ethdev_trace_points.c | 3 ++ lib/ethdev/rte_tm.c | 25 +++++++++++++++++ lib/ethdev/rte_tm.h | 48 ++++++++++++++++++++++++++++++++ lib/ethdev/rte_tm_driver.h | 12 ++++++++ 5 files changed, 104 insertions(+) diff --git a/lib/ethdev/ethdev_trace.h b/lib/ethdev/ethdev_trace.h index 3bec87bfdb..dee2819531 100644 --- a/lib/ethdev/ethdev_trace.h +++ b/lib/ethdev/ethdev_trace.h @@ -1903,6 +1903,22 @@ RTE_TRACE_POINT( rte_trace_point_emit_int(ret); ) +RTE_TRACE_POINT( + rte_tm_trace_node_query, + RTE_TRACE_POINT_ARGS(uint16_t port_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, int ret), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_u32(node_id); + rte_trace_point_emit_ptr(parent_node_id); + rte_trace_point_emit_ptr(priority); + rte_trace_point_emit_ptr(weight); + rte_trace_point_emit_ptr(level_id); + rte_trace_point_emit_ptr(params); + rte_trace_point_emit_int(ret); +) + RTE_TRACE_POINT( rte_tm_trace_node_delete, RTE_TRACE_POINT_ARGS(uint16_t port_id, uint32_t node_id, int ret), diff --git a/lib/ethdev/ethdev_trace_points.c b/lib/ethdev/ethdev_trace_points.c index 99e04f5893..f5ed7ca637 100644 --- a/lib/ethdev/ethdev_trace_points.c +++ b/lib/ethdev/ethdev_trace_points.c @@ -694,6 +694,9 @@ RTE_TRACE_POINT_REGISTER(rte_tm_trace_mark_vlan_dei, RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_add, lib.ethdev.tm.node_add) +RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_query, + lib.ethdev.tm.node_query) + RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_capabilities_get, lib.ethdev.tm.node_capabilities_get) diff --git a/lib/ethdev/rte_tm.c b/lib/ethdev/rte_tm.c index 3eb98e618a..8000b66af9 100644 --- a/lib/ethdev/rte_tm.c +++ b/lib/ethdev/rte_tm.c @@ -301,6 +301,31 @@ int rte_tm_node_add(uint16_t port_id, return ret; } +int rte_tm_node_query(uint16_t port_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, + struct rte_tm_error *error) +{ + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; + int ret; + + if (dev == NULL) + return -EINVAL; + + ret = RTE_TM_FUNC(port_id, node_query)(dev, + node_id, parent_node_id, priority, weight, level_id, + params, error); + + rte_tm_trace_node_query(port_id, node_id, parent_node_id, priority, + weight, level_id, params, ret); + + return ret; +} + /* Delete node from traffic manager hierarchy */ int rte_tm_node_delete(uint16_t port_id, uint32_t node_id, diff --git a/lib/ethdev/rte_tm.h b/lib/ethdev/rte_tm.h index e5da9b8323..419e491043 100644 --- a/lib/ethdev/rte_tm.h +++ b/lib/ethdev/rte_tm.h @@ -1599,6 +1599,54 @@ rte_tm_node_add(uint16_t port_id, const struct rte_tm_node_params *params, struct rte_tm_error *error); +/** + * Return information about a traffic management node + * + * Return information about a hierarchy node, using the same format of parameters + * as was passed to the rte_rm_node_add() function. + * Each of the "out" parameters pointers (except error) may be passed as NULL if the + * information is not needed by the caller. For example, to one may check if a node id + * is in use by: + * + * struct rte_tm_error error; + * int ret = rte_tm_node_query(port, node_id, NULL, NULL, NULL, NULL, NULL, &error); + * if (ret == ENOENT) ... + * + * @param[in] port_id + * The port identifier of the Ethernet device. + * @param[in] node_id + * Node ID. Should be a valid node id. + * @param[out] parent_node_id + * Parent node ID. + * @param[out] priority + * Node priority. The highest node priority is zero. Used by the SP algorithm + * running on the parent of the current node for scheduling this child node. + * @param[out] weight + * Node weight. The node weight is relative to the weight sum of all siblings + * that have the same priority. The lowest weight is one. Used by the WFQ + * algorithm running on the parent of the current node for scheduling this + * child node. + * @param[out] level_id + * The node level in the scheduler hierarchy. + * @param[out] params + * Node parameters, as would be used when creating the node. + * @param[out] error + * Error details. Filled in only on error, when not NULL. + * @return + * 0 on success, non-zero error code otherwise. + * -EINVAL - port or node id value is invalid + * -ENOENT - no node exists with the provided id + */ +int +rte_tm_node_query(uint16_t port_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, + struct rte_tm_error *error); + /** * Traffic manager node delete * diff --git a/lib/ethdev/rte_tm_driver.h b/lib/ethdev/rte_tm_driver.h index 6c2618c0d8..fc67f1cb4b 100644 --- a/lib/ethdev/rte_tm_driver.h +++ b/lib/ethdev/rte_tm_driver.h @@ -119,6 +119,16 @@ typedef int (*rte_tm_node_resume_t)(struct rte_eth_dev *dev, uint32_t node_id, struct rte_tm_error *error); +/** @internal Traffic manager node query */ +typedef int (*rte_tm_node_query_t)(const 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, + struct rte_tm_error *error); + /** @internal Traffic manager hierarchy commit */ typedef int (*rte_tm_hierarchy_commit_t)(struct rte_eth_dev *dev, int clear_on_fail, @@ -248,6 +258,8 @@ struct rte_tm_ops { rte_tm_node_suspend_t node_suspend; /** Traffic manager node resume */ rte_tm_node_resume_t node_resume; + /** Traffic manager node resume */ + rte_tm_node_query_t node_query; /** Traffic manager hierarchy commit */ rte_tm_hierarchy_commit_t hierarchy_commit;